This commit is contained in:
Marco 2025-03-04 17:50:16 +01:00
commit 5a09b7fcd1
18 changed files with 229 additions and 3 deletions

View file

@ -0,0 +1,28 @@
using Godot;
namespace Cirno.Scripts.Components.FSM;
public abstract partial class BaseState<TKey, TType> : Node2D, IState<TKey, TType>
where TKey : notnull
where TType : Node
{
public TKey StateId { get; }
public IStateMachine<TKey, TType> StateMachine => _stateMachine;
private IStateMachine<TKey, TType> _stateMachine;
public TType MainObject => _stateMachine.MainObject;
public virtual void Init(IStateMachine<TKey, TType> machine)
{
_stateMachine = machine;
}
public abstract void EnterState();
public abstract void ExitState();
public abstract void ProcessState(double delta);
public abstract void PhysicsProcessState(double delta);
}