public void ChangeGlobalState(int iStateID) { if (stateDic.ContainsKey(iStateID)) { globalState.OnDisable(); globalState = stateDic[iStateID]; globalState.OnEnable(); return; } Debug.LogErrorFormat("[CoreStatemanager] ICoreState isn't exsist.", iStateID); }
public void OnUpdate() { globalState.OnUpdate(); currentState.OnUpdate(); if (nextState == null) { return; } currentState.OnDisable(); lastState = currentState; currentState = nextState; nextState = null; currentState.OnEnable(); }