mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-14 16:03:46 +00:00
Game over and proper acid death
This commit is contained in:
parent
bacf41e726
commit
7d49c5a25e
13 changed files with 925 additions and 784 deletions
30
Scripts/Components/FSM/3DPlayer/Drowning.cs
Normal file
30
Scripts/Components/FSM/3DPlayer/Drowning.cs
Normal 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);
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue