Exemplo n.º 1
0
        public C_IState PopState()
        {
            if (m_StateStack.Count > 0)
            {
                C_IState state = m_StateStack.Pop();
                state.OnStateLeave();

                if (m_StateStack.Count > 0)
                {
                    m_StateStack.Peek().OnStateResume();
                }

                return(state);
            }

            return(null);
        }
Exemplo n.º 2
0
        public C_IState ChangeState(C_IState state)
        {
            if (state == null)
            {
                return(null);
            }

            TarState = state;
            C_IState state2 = null;

            if (m_StateStack.Count > 0)
            {
                state2 = m_StateStack.Pop();
                state2.OnStateLeave();
            }

            m_StateStack.Push(state);
            state.OnStateEnter();

            return(state2);
        }