public void ChangeState(State state) { if (m_ActiveStateStack.Count > 0) { m_ActiveStateStack[0].Exit(); m_ActiveStateStack.Remove(m_ActiveStateStack[0]); } m_ActiveStateStack.Insert(0, state); Init(state); state.Enter(); }
public bool PushState(State state) { if (m_ActiveStateStack.Count > 0) { if (!m_ActiveStateStack[0].Pause()) return false; } m_ActiveStateStack.Insert(0, state); Init(state); state.Enter(); return true; }