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,10 +8,7 @@ public partial class PlayerWeaponModule3D : ModuleBase<PlayerState, CharacterBod
[Export] public PlayerWeaponProvider3D WeaponProvider { get; private set; }
[Export] public InputProvider InputProvider { get; private set; }
[Export] public IsoPlayerStorageModule Storage { get; private set; }
private IStateMachine<PlayerState, CharacterBody3D> _stateMachine;
private CharacterBody3D MainObject => _stateMachine.MainObject;
private IsoPlayerStorageModule Storage { get; set; }
public override void EnterState(PlayerState state)
{
@ -25,8 +22,8 @@ public partial class PlayerWeaponModule3D : ModuleBase<PlayerState, CharacterBod
public override void Init(IStateMachine<PlayerState, CharacterBody3D> machine)
{
_stateMachine = machine;
base.Init(machine);
Storage ??= StateMachine.GetModule<IsoPlayerStorageModule>();
WeaponProvider.Init(MainObject);
}