mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 10:25:54 +00:00
Delay start for animation
This commit is contained in:
parent
1005796e13
commit
a9a7b234fb
9 changed files with 108 additions and 23 deletions
|
|
@ -14,7 +14,9 @@ public partial class AreaTrigger : Area2D
|
|||
private int _activations = 0;
|
||||
|
||||
[Signal]
|
||||
public delegate void ActivatedEventHandler();
|
||||
public delegate void ActivatedEventHandler();
|
||||
|
||||
private InteractionController _cachedPlayer;
|
||||
|
||||
private bool Activate()
|
||||
{
|
||||
|
|
@ -47,6 +49,23 @@ public partial class AreaTrigger : Area2D
|
|||
private void _on_area_entered(Area2D area)
|
||||
{
|
||||
if (area is not InteractionController player) return;
|
||||
if (player.Enabled)
|
||||
{
|
||||
Activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
_cachedPlayer = player;
|
||||
_cachedPlayer.InteractionStarted += PlayerOnInteractionStarted;
|
||||
}
|
||||
}
|
||||
|
||||
private void PlayerOnInteractionStarted()
|
||||
{
|
||||
Activate();
|
||||
if (_cachedPlayer != null)
|
||||
{
|
||||
_cachedPlayer.InteractionStarted -= PlayerOnInteractionStarted;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue