示例#1
0
            /// <summary>
            /// Enters a state, creating an instance of it if necessary.
            /// </summary>
            internal void Enter()
            {
                // Should a new instance be created?
                if ((_stateInstance == null) || (_owningMachine._stateInstantiationMode == StateInstantiationMode.PerTransition))
                {
                    _stateInstance = _owningMachine.InstantiateState(_stateType);
                }

                _stateInstance.Entering(_owningMachine.GetContext());
            }
 /// <summary>
 /// Enters a state after loading from storage, creating an instance of it if necessary.
 /// </summary>
 internal void EnterStateFromStorage()
 {
     InstantiateState();
     _stateInstance.EnteringFromStorage(_owningMachine.GetContext());
 }