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

@ -8,7 +8,7 @@ namespace Cirno.Scripts.Components.FSM._3DPlayer;
public partial class IsoMovementModule : ModuleBase<PlayerState, CharacterBody3D>
{
[Export] public IsoPlayerStorageModule PlayerStorage { get; private set; }
private IsoPlayerStorageModule PlayerStorage { get; set; }
[Export] private InputProvider _inputProvider;
[Export] public PlayerHitboxSpriteProvider3D HitboxSpriteProvider { get; private set; }
@ -29,9 +29,6 @@ public partial class IsoMovementModule : ModuleBase<PlayerState, CharacterBody3D
public int MovementSpeed => _isStrafing ? StrafeSpeed : Speed;
private IStateMachine<PlayerState, CharacterBody3D> _stateMachine;
private CharacterBody3D MainObject => _stateMachine.MainObject;
public override void EnterState(PlayerState state)
{
_accelerationPerSecond = Speed / Acceleration;
@ -44,7 +41,8 @@ public partial class IsoMovementModule : ModuleBase<PlayerState, CharacterBody3D
public override void Init(IStateMachine<PlayerState, CharacterBody3D> machine)
{
_stateMachine = machine;
base.Init(machine);
PlayerStorage ??= StateMachine.GetModule<IsoPlayerStorageModule>();
}
public override void Process(double delta)