コード例 #1
0
ファイル: HumanWaitingAction.cs プロジェクト: Glecun/automata
 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();
 }