Базовая инфраструктура
This commit is contained in:
1 parent
2e0dc15beb
commit
b5e28c7abb
117 files changed
+2068
-2031
No files matched your search
@@ -0,0 +1,23 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user