public void ChangeState(FSMState <T, U> NewState) { PreviousState = CurrentState; if (CurrentState != null) { CurrentState.Exit(); } CurrentState = NewState; if (CurrentState != null) { CurrentState.Enter(); } }
public void ChangeGlobalState(FSMState <T, U> NewGlobal) { if (GlobalState == null) { GlobalState = NewGlobal; GlobalState.Enter(); return; } GlobalState.Exit(); GlobalState = NewGlobal; if (GlobalState != null) { GlobalState.Enter(); } }