// Update is called once per frame void Update() { if (completed) { return; // Return early if hidden once } if (hideBehaviour.getNearbyHidingSpots().Count == 0) // If no hiding spots are within range, move to location { directionVector = hidingSpotTransform.position - transform.position; } else if (!hideBehaviour.isHidden()) // If in range, and not hidden, get in closest { hideBehaviour.hide(hideBehaviour.getClosestHidingSpot()); if (hideBehaviour.isHidden()) { completed = true; } } base.Update(); }
private void hide() { stop(); chase.setOperable(false); // disable chase action _hide.hide(); }