mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-15 04:03:46 +00:00
Add FSM components for player and enemy state management, including initialization and module resolution
This commit is contained in:
parent
18683c0680
commit
b6cc5a00e8
57 changed files with 526 additions and 506 deletions
|
|
@ -6,11 +6,13 @@ public partial class Drowning : PlayerStateBase
|
|||
{
|
||||
public override PlayerState StateId => PlayerState.Drowning;
|
||||
|
||||
[Export]
|
||||
private PlayerAnimationProvider _animationProvider;
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
_animationProvider ??= StateMachine.GetModule<PlayerAnimationProvider>();
|
||||
if (_animationProvider is null) return;
|
||||
|
||||
_animationProvider.PlayDrowningAnimation();
|
||||
|
||||
// Wait for animation to be over and switch to death
|
||||
|
|
@ -19,6 +21,7 @@ public partial class Drowning : PlayerStateBase
|
|||
|
||||
private void AnimationProviderOnOnAnimationEnded(StringName animationName)
|
||||
{
|
||||
if (_animationProvider is null) return;
|
||||
if (animationName != _animationProvider.DrowningAnimationName) return;
|
||||
|
||||
_animationProvider.OnAnimationEnded -= AnimationProviderOnOnAnimationEnded;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue