示例#1
0
 public void AddResource(Farm farm, int number, string plantType)
 {
     if (_plants.Count + number <= _capacity)
     {
         if (plantType == "wildflower")
         {
             for (int i = 0; i < number; i++)
             {
                 _plants.Add(new Wildflower());
             }
         }
         if (plantType == "sunflower")
         {
             for (int i = 0; i < number; i++)
             {
                 _plants.Add(new Sunflower());
             }
         }
     }
     else
     {
         if (plantType == "sunflower")
         {
             ChoosePlowedOrNaturalField.atCapacity = true;
             ChoosePlowedOrNaturalField.CollectInput(farm, number, plantType);
         }
         else
         {
             ChooseNaturalField.atCapacity = true;
             ChooseNaturalField.CollectInput(farm, number, plantType);
         }
     }
 }
示例#2
0
 public void AddResource(Farm farm, ICompostProducing plant)
 {
     if (_plants.Count < _capacity)
     {
         _plants.Add(plant);
     }
     else
     {
         Console.WriteLine("**** That facility is not large enough ****");
         Console.WriteLine("****     Please choose another one     ****");
         ChooseNaturalField.CollectInput(farm, plant);
     }
 }