Пример #1
0
 void Update()
 {
     waitAndDo(setRandomTargetPositionNearby, waitBeforeNextStep, durationWaitBeforeNextStep(),
               !pathInProgress.isMoving());
     transform.position = pathInProgress.changePosition(transform.position, HumanController.speed);
     humanAnimationController.isMoving = pathInProgress.isMoving();
 }
Пример #2
0
    private void Update()
    {
        if (state == State.GO_GATHER)
        {
            goGather();
        }
        if (state == State.RETURN_RESOURCE)
        {
            goReturnResource();
        }

        state = determineState();

        transform.position = pathInProgress.changePosition(transform.position, HumanController.speed);
        humanAnimationController.isMoving = pathInProgress.isMoving();
    }
Пример #3
0
 private void goGather()
 {
     if (!pathInProgress.isMoving() && retry)
     {
         var berryTreeController = getNearestBerryTreeMaybeCurrentlyCut();
         if (berryTreeController != null)
         {
             cutBerryTree(berryTreeController);
         }
         else
         {
             pathInProgress = humanMovementController.goToNearest(new GOTBerryTree(TreeStateEnum.FULL, null));
             if (!pathInProgress.isMoving())
             {
                 waitBeforeRetry();
             }
         }
     }
 }
Пример #4
0
 private void goReturnResource()
 {
     if (!pathInProgress.isMoving() && retry)
     {
         var townHallController = (TownHall)humanMovementController.getIfInRange(new GOTTownHall());
         if (townHallController != null)
         {
             depositFoodInto(townHallController);
         }
         else
         {
             pathInProgress = humanMovementController.goToNearest(new GOTTownHall());
             if (!pathInProgress.isMoving())
             {
                 waitBeforeRetry();
             }
         }
     }
 }
Пример #5
0
 void Update()
 {
     transform.position = pathInProgress.changePosition(transform.position, HumanController.speed);
     humanAnimationController.isMoving = pathInProgress.isMoving();
 }