protected virtual void Update()
 {
     if (currentState != null)
     {
         if (currentState.Run(this))
         {
             LoadNextState();
         }
     }
 }
Пример #2
0
 public override bool Run(AgentBase agent)
 {
     if (loopStates == null)
     {
         return(true);
     }
     if (loopStates.Count == 0)
     {
         return(true);
     }
     if (currentState != null)
     {
         if (currentState.Run(agent))
         {
             currentState.Complete(agent);
             if (iterator < loopStates.Count)
             {
                 currentState = loopStates[iterator];
                 currentState.Setup(agent);
                 iterator++;
             }
             else
             {
                 if (timesRun < loopAmount)
                 {
                     //Debug.Log("lets do it another time");
                     timesRun++;
                     iterator     = 0;
                     currentState = loopStates[iterator];
                     currentState.Setup(agent);
                     iterator++;
                 }
                 else
                 {
                     //Debug.Log(timesRun);
                     return(true);
                 }
             }
         }
     }
     else
     {
         return(true);
     }
     return(false);
 }