Ejemplo n.º 1
0
        public void Push(C_IState state)
        {
            if (state == null)
            {
                return;
            }

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

            m_StateStack.Push(state);

            state.OnStateEnter();
        }
Ejemplo 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);
        }