Example #1
0
 void FireGlobalEvent(BTEvent nextEvent)
 {
     if (currState != null)
     {
         currState.OnExit();
     }
     startEvent = nextEvent;
     currState  = startEvent.TargetState;
     startEvent.OnEnter();
     startEvent.OnExit();
     startEvent.Finish();
     startEvent = null;
     currState.OnEnter();
     //currState.OnEnter();
     //nextState = null;
 }
Example #2
0
 void Update()
 {
     if (nextState != null)
     {
         if (currState != null)
         {
             currState.OnExit();
         }
         lastState = currState;
         currState = nextState;
         nextState = null;
         currState.OnEnter();
     }
     if (currState == null)
     {
         Debug.LogError("BTFsm Current State is null", gameObject);
         return;
     }
     currState.OnUpdate();
 }