mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 20:56:01 +00:00
Drown animation
This commit is contained in:
parent
be88896252
commit
aa2de85f9a
16 changed files with 264 additions and 14 deletions
|
|
@ -64,7 +64,7 @@ public partial class Active : PlayerStateBase
|
|||
//_hud.UpdateShield(value, maxValue);
|
||||
};
|
||||
|
||||
_damageReceiver.Init();
|
||||
_damageReceiver.Init(StateMachine);
|
||||
|
||||
_damageReceiver.RefillHealth();
|
||||
_damageReceiver.RefillShield();
|
||||
|
|
|
|||
31
Scripts/Components/FSM/Player/Drowning.cs
Normal file
31
Scripts/Components/FSM/Player/Drowning.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Player;
|
||||
|
||||
public partial class Drowning : PlayerStateBase
|
||||
{
|
||||
public override PlayerState StateId => PlayerState.Drowning;
|
||||
|
||||
[Export]
|
||||
private PlayerAnimationProvider _animationProvider;
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
_animationProvider.PlayDrowningAnimation();
|
||||
|
||||
_animationProvider.OnAnimationEnded += AnimationProviderOnOnAnimationEnded;
|
||||
// Wait for animation over and switch to death
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void AnimationProviderOnOnAnimationEnded(StringName animationName)
|
||||
{
|
||||
if (animationName != _animationProvider.DrowningAnimationName) return;
|
||||
|
||||
_animationProvider.OnAnimationEnded -= AnimationProviderOnOnAnimationEnded;
|
||||
|
||||
StateMachine.SetState(PlayerState.Dead);
|
||||
|
||||
}
|
||||
}
|
||||
1
Scripts/Components/FSM/Player/Drowning.cs.uid
Normal file
1
Scripts/Components/FSM/Player/Drowning.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bgve2lktony00
|
||||
Loading…
Add table
Add a link
Reference in a new issue