Init
This commit is contained in:
1 parent
a73338916a
commit
fbc1cc8d3e
207 files changed
+10327
-2
No files matched your search
@@ -0,0 +1,37 @@
|
||||
namespace Code.Infrastructure.StateMachine
|
||||
{
|
||||
public abstract class BaseState<TEnum, TStateMachineContext>
|
||||
{
|
||||
public abstract TEnum myState { get; }
|
||||
|
||||
protected BaseState(TStateMachineContext context, EventBus.EventBus eventBus)
|
||||
{
|
||||
Context = context;
|
||||
EventBus = eventBus;
|
||||
}
|
||||
|
||||
protected EventBus.EventBus EventBus;
|
||||
protected TStateMachineContext Context { get; }
|
||||
|
||||
protected virtual void _fireEnterState()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void _fireExitState()
|
||||
{
|
||||
}
|
||||
|
||||
protected abstract void OnEnterState();
|
||||
protected abstract void OnExitState();
|
||||
public void EnterState()
|
||||
{
|
||||
OnEnterState();
|
||||
_fireEnterState();
|
||||
}
|
||||
public void ExitState()
|
||||
{
|
||||
OnExitState();
|
||||
_fireExitState();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user