mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 08:05:53 +00:00
New FSM
This commit is contained in:
parent
b0d5edc84e
commit
5a09b7fcd1
18 changed files with 229 additions and 3 deletions
28
Scripts/Components/FSM/BaseState.cs
Normal file
28
Scripts/Components/FSM/BaseState.cs
Normal 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue