示例#1
0
 public virtual void Update(float interval)
 {
     if (_triggerTrans == null)
     {
         for (int i = 0; i < _toTransitionList.Count; i++)
         {
             var trans = _toTransitionList[i];
             if (trans.IsCanTrans())
             {
                 _triggerTrans            = trans;
                 _triggerTrans.TransState = FsmTransitionStateEnum.Transing;
                 OnExitState(trans.ToState);
                 break;
             }
         }
     }
     if (_triggerTrans == null)
     {
         UpdateEx(interval);
     }
     else
     {
         FsmTransitionStateEnum state = _triggerTrans.ExcuteTrans(this, _triggerTrans.ToState);
         if (state == FsmTransitionStateEnum.Finish)
         {
             _triggerTrans.TransState = FsmTransitionStateEnum.Transing;
             _machine.CurrentState.OnEnterState(this);
             _triggerTrans = null;
         }
     }
 }
示例#2
0
 public AbsFsmTransition(FsmMachine machine, string name)
 {
     _name              = name;
     _entity            = machine.Entity;
     _machine           = machine;
     _transState        = FsmTransitionStateEnum.Transing;
     _transitionHandler = null;
     _formState         = null;
     _toState           = null;
 }