Exemple #1
0
        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;
                }
            }
        }
Exemple #2
0
        public void AddAnyTransition(IState to, Func <bool> condition)
        {
            var stateTransition = new StateTransition(null, to, condition);

            _anyStateTransitions.Add(stateTransition);
        }