mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:05:34 +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
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue