void Start() { enemies = GameObject.FindObjectOfType <SpannerShipsEnemies>().all__ships; score_handler = GameObject.FindObjectOfType <ScoreHandlerVecinosInvasores> (); effectFireworks = GameObject.FindObjectOfType <HandleFireworksEffetsVecinosInasores> (); sounds = GameObject.FindObjectOfType <SoundsInVecinosInvasores> (); }
// Use this for initialization void Start() { //animal_tochase = GameObject.Find("animal"); sound_handler = GameObject.FindObjectOfType <SoundsInVecinosInvasores> (); if (sound_handler.sound_teleport.isPlaying == true) { sound_handler.sound_teleport.Stop(); } sound_handler.sound_teleport.Play(); GameObject[] animals = GameObject.FindGameObjectsWithTag("Animals"); List <GameObject> temp_animals_free = new List <GameObject> (); for (int i = 0; i < animals.Length; i++) { if (animals[i].GetComponent <AnimalData>().isChasen == false && animals[i].GetComponent <AnimalData>().isCaught == false) { temp_animals_free.Add(animals[i]); } } if (temp_animals_free.Count > 0) { int random = Random.Range(0, temp_animals_free.Count); animal_tochase = temp_animals_free [random]; animal_tochase.GetComponent <AnimalData> ().isChasen = true; } else { ManagerVecinosInvasores manager = GameObject.FindObjectOfType <ManagerVecinosInvasores> (); manager.timer_game = -1; HoldParametersVecinosInvasores.repeticiones_restantes = 0; } }