void Update() { waitAndDo(setRandomTargetPositionNearby, waitBeforeNextStep, durationWaitBeforeNextStep(), !pathInProgress.isMoving()); transform.position = pathInProgress.changePosition(transform.position, HumanController.speed); humanAnimationController.isMoving = pathInProgress.isMoving(); }
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(); }
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(); } } } }
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(); } } } }
void Update() { transform.position = pathInProgress.changePosition(transform.position, HumanController.speed); humanAnimationController.isMoving = pathInProgress.isMoving(); }