private void Update() { // handle StateMachine AbstractState newState = currentState.UpdateState(); if (newState != null) { currentState.OnExit(); currentState = newState; currentState.OnEnter(); } }
public void Run() { AbstractState <T> previous = currentState; if (Manager.GetNewState(ref currentState)) { previous.OnExit(Entity); currentState.OnEnter(Entity); currentState.InState(Entity); } else { currentState.InState(Entity); } }