Exemple #1
0
 public void StopTimeout()
 {
     if (timeout != null)
     {
         StopCoroutine(timeout.Coroutine);
         timeout = null;
     }
 }
Exemple #2
0
 // i can only have one active FSM state
 // If the state needs to use some kind of countdown, it can make use of this timeout system based on coroutines.
 // Everytime I set a new Timeout, I need to stop the last timeout (aka stop the coroutine if it exists) and
 //   start a new timeout and a new coroutine.
 // This method can be called by any FSM State (since every Reason and Act state methods have acess to the GameObject, and
 //   there is only one FSM for every gameObject (so it's a 1:1 relation).
 // The call on the FSM State is like npc.getComponent<NPCControl>().StartTimeout(time);
 public void StartTimeout(float waitTime)
 {
     StopTimeout();
     timeout = new FSMTimeout(waitTime);
     StartCoroutine(timeout.Coroutine);
 }