mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
23 lines
No EOL
837 B
C#
23 lines
No EOL
837 B
C#
using Godot;
|
|
|
|
namespace Cirno.Scripts.Components.FSM;
|
|
|
|
public abstract partial class ModuleBase<TKey, TType> : Node, IModule<TKey, TType>
|
|
where TKey : notnull
|
|
where TType : Node
|
|
{
|
|
// Provide the state machine reference for derived modules to use without repeating boilerplate
|
|
protected IStateMachine<TKey, TType> StateMachine { get; private set; }
|
|
protected TType MainObject => StateMachine.MainObject;
|
|
|
|
// Default Init behaviour sets the state machine reference. Derived classes can still override
|
|
public virtual void Init(IStateMachine<TKey, TType> machine)
|
|
{
|
|
StateMachine = machine;
|
|
}
|
|
|
|
public abstract void EnterState(TKey state);
|
|
public abstract void ExitState(TKey state);
|
|
public abstract void Process(double delta);
|
|
public abstract void PhysicsProcess(double delta);
|
|
} |