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