示例#1
0
 public override void EndAction()
 {
     dog.AddEffectToMood(moodEffect);
     if (currentAction != null)
     {
         currentAction.EndAction();
     }
 }
 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;
             }
         }
     }
 }
示例#3
0
 public override void EndAction()
 {
     currentAction.EndAction();
     isDone = true;
 }