//create an animalhouse public Animalhouse createAnimalhouse(Enum animalType, String name) { Animalhouse temp = new Animalhouse(animalType, name); if (decreaseCoins(temp.getPrice()) == true) { return(temp); } return(null); }
//adds a created animalhouse to the park public void addAnimalHouse(Animalhouse building) { foreach (Animalhouse currentBuilding in animalhouses) { if (currentBuilding.getName() == building.getName()) { throw new Exception("Can't add this building. There is already a building with this name."); } } animalhouses.Add(building); }
//select an animalhouse by inserted name public Animalhouse selectAnimalHouse(string name) { foreach (Animalhouse currentBuilding in animalhouses) { if (currentBuilding.getName() == name) { selectedAnimalHouse = currentBuilding; return(currentBuilding); } } return(null); }