/// <summary> /// Creates an instance of a state if necessary. /// </summary> internal void InstantiateState() { // Should a new instance be created? if ((_stateInstance == null) || (_owningMachine._stateInstantiationMode == StateInstantiationMode.PerTransition)) { _stateInstance = _owningMachine.InstantiateState(_stateType); } }
/// <summary> /// Exits the state that this configuration is linked to. /// </summary> internal void Exit() { if (_stateInstance != null) { _stateInstance.Exiting(_owningMachine.GetContext()); // If we're instantiating per transition, we release the reference to the instance if (_owningMachine._stateInstantiationMode == StateInstantiationMode.PerTransition) { _stateInstance = null; } } }