23 lines
618 B
C#
23 lines
618 B
C#
namespace Code.StateMachine
|
|
{
|
|
public abstract class BaseState<TStateMachineContext>
|
|
{
|
|
public delegate void Entered();
|
|
public event Entered OnEntered;
|
|
|
|
public delegate void Exited();
|
|
public event Exited OnExited;
|
|
|
|
public BaseState(TStateMachineContext context)
|
|
{
|
|
Context = context;
|
|
}
|
|
public TStateMachineContext Context { get; protected set; }
|
|
|
|
public virtual void EnterState() => OnEntered?.Invoke();
|
|
|
|
public virtual void Tick(){}
|
|
|
|
public virtual void ExitState() => OnExited?.Invoke();
|
|
}
|
|
} |