mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
28 lines
716 B
C#
28 lines
716 B
C#
|
|
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);
|
|||
|
|
}
|