Game over and proper acid death

This commit is contained in:
Marco 2025-07-02 15:15:47 +02:00
commit 7d49c5a25e
13 changed files with 925 additions and 784 deletions

View file

@ -0,0 +1,30 @@
using Cirno.Scripts.Components.Actors._3D;
using Godot;
namespace Cirno.Scripts.Components.FSM._3DPlayer;
public partial class Drowning : BaseState<PlayerState, CharacterBody3D>
{
public override PlayerState StateId => PlayerState.Drowning;
[Export]
private PlayerAnimationProvider3D _animationProvider;
public override void EnterState()
{
_animationProvider.PlayDrowningAnimation();
// Wait for animation to be over and switch to death
_animationProvider.OnAnimationEnded += AnimationProviderOnOnAnimationEnded;
}
private void AnimationProviderOnOnAnimationEnded(StringName animationName)
{
if (animationName != _animationProvider.DrowningAnimationName) return;
_animationProvider.OnAnimationEnded -= AnimationProviderOnOnAnimationEnded;
StateMachine.SetState(PlayerState.Dead);
}
}