Ejemplo n.º 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);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }