Example #1
0
        //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);
        }
Example #2
0
 //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);
 }
Example #3
0
 //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);
 }