コード例 #1
0
ファイル: FSM.cs プロジェクト: yxxyws/niuniu
 public void InsertState(FsmStateStruct <T> iStateFunc)
 {
     if (this.mFsmDict.ContainsKey(iStateFunc.mId))
     {
         Debug.LogError("Fsm Contain two" + iStateFunc.mId + " state!");
         return;
     }
     this.mFsmDict.Add(iStateFunc.mId, iStateFunc);
 }
コード例 #2
0
ファイル: FSM.cs プロジェクト: yxxyws/niuniu
 public void SetCurrentState(T iId)
 {
     if (!this.mFsmDict.ContainsKey(iId))
     {
         Debug.LogError("FsmDictionary do not contain " + iId + " state!");
         return;
     }
     this.NextState = this.mFsmDict[iId];
     if (this.CurrentState != null)
     {
         this.CurrentState.mExit();
         this.LastState = this.CurrentState;
     }
     this.CurrentState = this.mFsmDict[iId];
     if (this.LastState == null)
     {
         this.LastState = this.CurrentState;
     }
     this.CurrentState.mEnter();
 }
コード例 #3
0
ファイル: FSM.cs プロジェクト: yxxyws/niuniu
 public FSM()
 {
     this.CurrentState = null;
     this.LastState    = null;
     this.mFsmDict     = new Dictionary <T, FsmStateStruct <T> >();
 }