// Use this for initialization void Start() { playerAnimator = GetComponent <Animator>(); fishingPoleAnimator = FishingPole.GetComponent <Animator>(); fishController = Fish.GetComponent <fishController>(); fishHooked = false; numFishCaught = 0; StartCoroutine(waitForFish()); fishIcons = FishIconsGrid.GetComponentsInChildren <Image>(); fishIconTransforms = FishIconsGrid.GetComponentsInChildren <RectTransform>(); }
// process awareness of neighbours void heedNeighbours(GameObject fish, float neighbourDistance) { // Check if fish has neighbours within defined range if (neighbourDistance <= flockController.neighbourRange) { flockCenter += fish.transform.position; groupSize++; // Add to avoidance vector if we come too close to another fish if (neighbourDistance < flockController.flockDensity) { avoidanceVector += (this.transform.position - fish.transform.position); } // Add this fish's speed to average group speed fishController thisFishController = fish.GetComponent <fishController>(); averageGroupSpeed += thisFishController.fishSpeed; } }
// Use this for initialization void Start() { failSound.volume = 0.15f; playerAnimator = GetComponent <Animator>(); fishingPoleAnimator = FishingPole.GetComponent <Animator>(); previousQuadrant = 1; previousRotationDirection = 0; startQuadrant = 0; currentPowerLevel = 0; targetPowerLevel = 0; idleTime = 0; fishController = Fish.GetComponent <fishController>(); numFishCaught = 0; StartCoroutine(waitForFish()); fishIcons = FishIconsGrid.GetComponentsInChildren <Image>(); fishIconTransforms = FishIconsGrid.GetComponentsInChildren <RectTransform>(); }