public void ManuallySetState(IState stateToTransitionTo) { if (stateToTransitionTo == _currentState) { return; } for (int i = 0; i < _stateTransitions.Count; i++) { if (_stateTransitions[i].From == _currentState) { manuallySetState = stateToTransitionTo; manuallySetTransition = AddTransition(_currentState, stateToTransitionTo, () => this.manuallySetState != null && this.manuallySetTransition != null); break; } } }
public void AddAnyTransition(IState to, Func <bool> condition) { var stateTransition = new StateTransition(null, to, condition); _anyStateTransitions.Add(stateTransition); }