示例#1
0
文件: FSMBase.cs 项目: zzhehe/3DDemo
 public void ChangeState(StateType stateType)
 {
     foreach (var item in statesList)
     {
         if (item.stateType == stateType)
         {
             if (currentState != null && IsCanChange)
             {
                 currentState.OnExit();
                 currentState = item;
                 currentState.OnEnter();
             }
             else if (currentState == null)
             {
                 currentState = item;
                 currentState.OnEnter();
             }
         }
     }
 }