Exemple #1
0
 public override void UpdateAction()
 {
     if (!isDone)
     {
         if (currentAction.IsDone())
         {
             NextAction();
         }
         currentAction.UpdateAction();
     }
 }
 public override void UpdateAction()
 {
     if (!isDone)
     {
         if (currentAction.IsDone())
         {
             currentAction = new GotoPosition(dog, GetRandomTarget(), 0.5f);
         }
         currentAction.UpdateAction();
     }
 }
Exemple #3
0
 public override void UpdateAction()
 {
     if (!isDone)
     {
         if (!currentAction.IsDone())
         {
             currentAction.UpdateAction();
         }
         else
         {
             isDone = true;
         }
     }
 }
 public override void UpdateAction()
 {
     if (!isDone)
     {
         currentAction.UpdateAction();
         if (Vector2.Distance(new Vector2(dog.transform.position.x, dog.transform.position.z), new Vector2(target.x, target.z)) < width)
         {
             if (waitForPlayerAtTarget)
             {
                 if (Vector2.Distance(new Vector2(player.position.x, player.position.z), new Vector2(target.x, target.z)) < 5f)
                 {
                     isDone = true;
                 }
             }
             else
             {
                 isDone = true;
             }
         }
         if (!ShouldWait())
         {
             if (isWaiting)
             {
                 if (currentAction.IsDone())
                 {
                     currentAction.EndAction();
                     currentAction = new GoStraightToPosition(dog, target, 1.5f);
                     currentAction.StartAction();
                     isWaiting = false;
                 }
             }
         }
         else
         {
             if (!isWaiting)
             {
                 currentAction.EndAction();
                 currentAction = new WaitForPlayer(dog, player, target, maxDistance / 2);
                 currentAction.StartAction();
                 isWaiting = true;
             }
         }
     }
 }