Пример #1
0
        private void AddTransition(TransitionDetails <TState, TTrigger> transition)
        {
            if (transition.FromState.State.IsEqual(State))
            {
                if (_transitionsFrom.Contains(transition))
                {
                    return;
                }

                _transitionsFrom.Add(transition);
                IsFinalState = false;

                if (!transition.IsDynamic)
                {
                    transition.ToState.AddTransition(transition);
                }
            }
            else
            {
                if (_transitionsTo.Contains(transition))
                {
                    return;
                }

                _transitionsTo.Add(transition);

                transition.FromState.AddTransition(transition);
            }
        }
Пример #2
0
        public TransitionDetails <TState, TTrigger> CreateTransitionFrom(string name
                                                                         , TTrigger trigger
                                                                         , StateDetails <TState, TTrigger> toState = null
                                                                         , bool hasCondition = false
                                                                         , uint priority     = 1
                                                                         , bool isDynamic    = false)
        {
            var transition = new TransitionDetails <TState, TTrigger>(name
                                                                      , this
                                                                      , trigger
                                                                      , toState
                                                                      , hasCondition
                                                                      , priority
                                                                      , isDynamic);

            AddTransition(transition);

            return(transition);
        }
Пример #3
0
        public TransitionDetails <TState, TTrigger> CreateTransitionTo(string name
                                                                       , StateDetails <TState, TTrigger> fromState
                                                                       , TTrigger trigger
                                                                       , bool hasCondition = false
                                                                       , uint priority     = 1
                                                                       , bool isDynamic    = false)
        {
            var transition = new TransitionDetails <TState, TTrigger>(name
                                                                      , fromState
                                                                      , trigger
                                                                      , this
                                                                      , hasCondition
                                                                      , priority
                                                                      , isDynamic);

            addTransition(transition);

            return(transition);
        }