Пример #1
0
 /// <summary> 退出,供ExitState调用 </summary>
 public void Exit(OutState exit)
 {
     if (exit == this.outState)
     {
         transitionList.ForEach(x =>
         {
             if (_mainFsm.LoopThroughTrasitionConditions(this, x))
             {
                 return;
             }
         });
     }
 }
Пример #2
0
        // ----------------------
        /// <summary> 构造函数 </summary>
        public SubFsm(MainFsm mainFsm, string name, FsmBase fsmBelongTo = null)
        {
            this._mainFsm     = mainFsm;
            this._fsmBelongTo = fsmBelongTo ?? mainFsm;
            transitionList    = new List <StateTransition>();

            inState      = new IntoState(this._mainFsm, this);
            outState     = new OutState(this._mainFsm, this);
            _currentNode = inState;

            this._name = name ?? this.GetType().ToString();
            mainFsm.AddNode(this);
        }