Esempio n. 1
0
        public void AddTransition(IFsmState last, IFsmState next, FsmTransition transition)
        {
            if (!_states.ContainsValue(last) || !_states.ContainsValue(next))
            {
                throw new InvalidOperationException("未添加的状态");
            }

            var index = _transitions.FindIndex(i => i.Last == last);
            FsmTransitionChain trans;

            if (index == -1)
            {
                trans             = new FsmTransitionChain(last);
                last.TransitionId = _transitions.Count;
                _transitions.Add(trans);
            }
            else
            {
                trans = _transitions[index];
            }

            trans.TransitionList.Add(new FsmTransitionInfo(next, transition));
        }
 public FsmTransitionInfo(IFsmState next, FsmTransition transition)
 {
     Next       = next;
     Transition = transition;
 }