Ejemplo n.º 1
0
        public void Update()
        {
            if (!Enable || m_wasShutdown)
            {
                return;
            }

            // Do transition to another state
            if (CanEnterQueuedState())
            {
                if (m_currentState != null && m_queuedState != null)
                {
                    m_currentState.ExitState(this, QueuedStateId);
                }

                m_previousState = m_currentState;                   // Store prev state ...
                m_currentState  = m_queuedState;                    // Set to next state ...
                m_queuedState   = null;                             // Remove queued state ...

                m_currentState.EnterState(this, PreviousStateId, m_context);
            }
            // Clear queued states which cannot be entered ...
            else
            {
                m_queuedState = null;
            }

            // Update current state ...
            if (m_currentState != null)
            {
                m_currentState.UpdateState(this);
            }
        }