[SerializeField] private Text sliderText = null; //< The text next to the slider showing what value the slider is set to /** * Called before the first frame update */ private void Start() { // Get references to the existing managers theGameManager = FindObjectOfType <GameManager>(); theTowerManager = FindObjectOfType <TowerManager>(); school = FindObjectOfType <FishSchool>(); }
public void Init(FishSchool school) { waveOffset = MathUtil.Map(this.transform.position.x, school.leftmost, school.rightmost, 0.25f, 0); waveWidth = school.waveWidth; waveHeight = school.waveHeight; this.killShakeMultipler = 0f; this.hitStopMultiplier = 0f; }
/** * Called when the fish is enabled */ private void OnEnable() { // Get References rigid = GetComponent <Rigidbody>(); fishAppearance = GetComponentInChildren <FishAppearance>(); school = FindObjectOfType <FishSchool>(); // Craft the path this fish will follow // While the fish is waiting to have its school assigned by the Fish School script, we wait destination = school.initialDestinations[Random.Range(0, 5)]; Vector3 lookPosition = destination.destinationPosition - transform.position; destinationDirection = Quaternion.LookRotation(lookPosition); //destinationDistance = Vector3.Distance(transform.position, destination.destinationPosition); //travelTime = destinationDistance / swimSpeed; path.Add(destination); Destination currentNode = destination; while (craftingPath) { Destination newNode = currentNode.destinations[Random.Range(0, 5)]; if (newNode.finalDestination == true) { path.Add(newNode); craftingPath = false; } else { path.Add(newNode); currentNode = newNode; } } // Set up initial energy currentEnergy = startingEnergy; }
private void SetCollected() { isCollected = true; collectionScores [code]++; if (auraParticles != null) { Destroy(auraParticles); } if (collectedParticlesPrefab != null) { powParticles = Instantiate(collectedParticlesPrefab, gameObject.transform.position, Quaternion.identity) as GameObject; powParticles.transform.parent = particlesContainer.transform; Destroy(powParticles, 10); } FishSchool school = GetComponentInParent <FishSchool>(); if (school != null) { school.CollectFish(gameObject); } }
/** * Set the school that the fish belongs to */ public void SetSchool(FishSchool school) { this.school = school; }