Exemple #1
0
        /// <summary>
        /// Enters a new state (if there is one) and raises the OnTransitioned event.
        /// </summary>
        private void EnterNewState(Type previousStateType, StateConfiguration state)
        {
            _currentState = state;

            Type currentStateType = null;

            // Are we entering a new state?
            if (_currentState != null)
            {
                currentStateType = _currentState.StateType;
                _currentState.Enter();
            }

            // Raise an event about the transition
            OnTransitioned(new TransitionedEventArgs(previousStateType, currentStateType));
        }