//Setup for dinsoaur adds a first batch of dinosaurs to the list and spawns them all at once public void Setup() { Dinosaurs = Resources.LoadAll("Prefabs/Dinosaurs"); for (int i = 0; i < (maxDinos - 1); i++) { DinosaurScript dinosaur = NewCustomer(i * 2).GetComponent <DinosaurScript>(); Dinos.Add(dinosaur); dinosaur.startSequence(); } }
//Destroys the Dino that requests so, also deletes it from the list and spawns a new customer public void DestroyDino(DinosaurScript dino) { Debug.Log("22"); Dinos.Remove(dino); Destroy(dino.gameObject); GameObject Dinosaur = NewCustomer(Dinos.Count); if (Dinosaur != null) { DinosaurScript dinoScript = Dinosaur.GetComponent <DinosaurScript>(); Dinos.Add(dinoScript); dinoScript.startSequence(); } }