Files
Infratest/Assets/Code/Infrastructure/StateMachine/BaseState.cs
T
2026-01-20 20:38:20 +03:00

39 lines
940 B
C#

using Code.Infrastructure.App;
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();
}
}
}