public override void Execute() { if (mCurrentState != null) { if (mCurrentState.mStateFlag == ISMStateBase.StateFlag.BeforeEnter) { mCurrentState.Enter(); } else if (mCurrentState.mStateFlag == ISMStateBase.StateFlag.Executing) { mCurrentState.Execute(); } else if (mCurrentState.mStateFlag == ISMStateBase.StateFlag.BeforeExit) { mCurrentState.Exit(); } else if (mCurrentState.mStateFlag == ISMStateBase.StateFlag.AfterExit) { mCurrentState.ReInit(); mCurrentState = null; } } else { if (mStateQueue.Count > 0) { mCurrentState = mStateQueue.Dequeue(); } else { EndSelf(); } } }
public void Pop(ISMState <T> state) { if (ContainsState(state)) { Remove(state); state.Exit(); } }
public void Pop(string name) { for (int i = 0; i < m_states.Count; i++) { ISMState <T> state = m_states[i]; if (state.mName == name) { Remove(state); state.Exit(); } } }
public virtual void Update() { for (int i = 0; i < m_states.Count; i++) { ISMState <T> state = m_states[i]; if (state.mStateFlag == ISMStateBase.StateFlag.Executing) { if (state.IsPause() == false) { state.Execute(); } } if (state.mStateFlag == ISMStateBase.StateFlag.BeforeExit) { Remove(state); state.Exit(); } } }