Add FSM components for player and enemy state management, including initialization and module resolution

This commit is contained in:
MaddoScientisto 2026-02-26 23:13:57 +01:00
commit b6cc5a00e8
57 changed files with 526 additions and 506 deletions

View file

@ -1,5 +1,4 @@
using System.Threading.Tasks;
using Godot;
using Godot;
namespace Cirno.Scripts.Components.FSM._3DPlayer;
@ -9,9 +8,9 @@ public partial class Init : BaseState<PlayerState, CharacterBody3D>
public override void EnterState()
{
// _storageModule.FacingDirection = ((PlayerStateMachine)StateMachine).StartingDirection;
// _animationProvider.PlayUnteleportAnimation();
_ = AutoSwitchToStart();
// Use Godot timer instead of Task.Delay to stay on main thread
var timer = GetTree().CreateTimer(0.5f);
timer.Timeout += () => StateMachine.SetState(PlayerState.Active);
}
public override void ExitState()
@ -28,10 +27,4 @@ public partial class Init : BaseState<PlayerState, CharacterBody3D>
{
}
private async Task AutoSwitchToStart()
{
await Task.Delay(500);
StateMachine.SetState(PlayerState.Active);
}
}