Ejemplo n.º 1
0
 /// <summary>
 /// Plants the given crop in this field
 /// </summary>
 /// <param name="seed">Crop to plant</param>
 public void PlantSeed(Seed seed)
 {
     if (PlantedSeed == null)
       {
     PlantedSeed = seed;
     PlantedSeed.SetField(this);
     PlantedSeed.InitializeCrops();
       }
       else
     throw new Exception("There is already a seed planted!");
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Remove a seed from the inventory
 /// </summary>
 /// <param name="seed">Seed to remove from inventory</param>
 public void RemoveSeedFromInventory(Seed seed)
 {
     SeedInventory[seed.Name].Remove(seed);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds a seed to the seed inventory
 /// </summary>
 /// <param name="seed">Seed to add to the seed inventory</param>
 public void AddSeedToInventory(Seed seed)
 {
     SeedInventory[seed.Name].Add(seed);
 }
Ejemplo n.º 4
0
        private static void HarvestSelectionDialog(Seed seed)
        {
            string anweisung;
              while(true)
              {
            PrintInfoMessage("Which crop do you want to harvest? [enter comma seperated indexes; back]\r\n\r\n" + seed.GetCropInfo());

            anweisung = Console.ReadLine();
            if (anweisung == "back" || anweisung == "b")
              break;

            try
            {
              string[] indexStrings = anweisung.Split(',');
              int[] indexes = Array.ConvertAll(indexStrings, int.Parse);

              seed.Harvest(indexes);
              break;
            }
            catch(Exception ex)
            {
              PrintInfoMessageAndWait(ex.Message);
            }
              }
        }
Ejemplo n.º 5
0
        private static void HarvestFieldDialog(Seed seed)
        {
            string anweisung;
              while (true)
              {
            PrintInfoMessage("Which crops to you want to harvest [all; selection; back]\r\n\r\n" + seed.GetCropInfo());

            anweisung = Console.ReadLine();
            if (anweisung == "all" || anweisung == "a")
            {
              HarvestAllDialog(seed);
              break;
            }
            else if (anweisung == "selection" || anweisung == "s")
            {
              HarvestSelectionDialog(seed);
              if (seed.Crops.Count == 0)
            break;
            }
            else if (anweisung == "back" || anweisung == "b")
              break;

              }
        }
Ejemplo n.º 6
0
        private static void HarvestAllDialog(Seed seed)
        {
            string anweisung;
              while (true)
              {
            PrintInfoMessage("Do you really want to harvest all crops? They will be put in your inventory. [yes; no]\r\n\r\n" + seed.GetCropInfo());
            anweisung = Console.ReadLine();

            if (anweisung == "yes" || anweisung == "y")
            {
              seed.Harvest();
              PrintInfoMessageAndWait("Crops harvested! They have been placed in your inventory.");
              break;
            }
            else if (anweisung == "no" || anweisung == "n")
              break;
              }
        }