public void AddTransition(string fromStateName, string toStateName, TransitionCondition condition)
        {
            IState fromState = new EmptyState();

            if (states[fromStateName] != fromState)
            {
                fromState = states[fromStateName];
            }
            Transition transition = new Transition(toStateName, condition);

            if (!states.ContainsKey(toStateName) && !states.TryGetValue(fromStateName, out fromState))
            {
                return;
            }

            if (!transitions.ContainsKey(fromState))
            {
                transitions.Add(fromState, new List <Transition>());
            }

            if (!transitions[fromState].Contains(transition))
            {
                transitions[fromState].Add(transition);
            }
        }
        public void AddTransition(TransitionCondition value)
        {
            TransitionCondition[] tempArr;

            if (arrTransitionList == null)
            {
                tempArr    = new TransitionCondition[1];
                tempArr[0] = value;
            }
            else
            {
                for (int idx = 0; idx < arrTransitionList.Length; idx++)
                {
                    if (value.eTransID != 0 && arrTransitionList[idx].eTransID == value.eTransID)
                    {
                        UDL.LogWarning("동일한 전이 ID를 추가합니다", FSM.logOption, FSM.warningLoglv);
                    }
                }

                tempArr = new TransitionCondition[arrTransitionList.Length + 1];

                for (int i = 0; i < arrTransitionList.Length; i++)
                {
                    tempArr[i] = arrTransitionList[i];
                }

                tempArr[arrTransitionList.Length] = value;
            }

            arrTransitionList = tempArr;

            value.SetOwnerForTimeCond(this);
        }
示例#3
0
        public void RegisterTransition(string fromStateName, string toStateName, TransitionCondition condition)
        {
            IState fromState;

            if (!(states.TryGetValue(fromStateName, out fromState) && states.ContainsKey(toStateName)))
            {
                return;
            }

            if (!transitions.ContainsKey(fromState))
            {
                transitions.Add(fromState, new List <StateTransition>());
            }

            transitions[fromState].Add(new StateTransition(toStateName, condition));
        }
 public Transition(string destinationState, TransitionCondition condition)
 {
     DestinationState  = destinationState;
     EvaluateCondition = condition;
 }
示例#5
0
 public StateTransition(string desiredState, TransitionCondition condition)
 {
     this.desiredState = desiredState;
     this.condition    = condition;
 }