/// <summary> /// method to check the userinput with the animal names /// </summary> private void CheckName() { foreach (var anml in spawnedAnimals) { Animal animal = anml.GetComponent <Animal>(); if (input == animal.name) { animal.SayHello(); } } }
/// <summary> /// to let all the animals say hello /// </summary> private void SayHi() { foreach (var animal in spawnedAnimals) { Animal animals = animal.GetComponent <Animal>(); if (animals != null) { animals.SayHello(); } } }