Esempio n. 1
0
 /// <summary>
 /// Initializes a new seed
 /// </summary>
 public Seed(string name, double baseSeedGrowth, Enumerations.SeedType seedType, Enumerations.Quality seedQuality, double requiredWater, Crop parentCrop, double optimalTemperature, int cropRate, double baseCropGrowth)
 {
     Name = name;
       BaseSeedGrowth = baseSeedGrowth;
       SeedGrowth = 0;
       BaseCropGrowth = baseCropGrowth;
       Age = 0;
       Health = 100.0;
       SeedType = seedType;
       SeedQuality = seedQuality;
       RequiredWaterBase = requiredWater;
       Crops = new List<Crop>();
       OptimalTemperature = optimalTemperature;
       _cropRate = cropRate;
       ParentCrop = parentCrop;
 }
Esempio n. 2
0
 /// <summary>
 /// Removes a crop from the inventory
 /// </summary>
 /// <param name="crop">Crop to remove from inventory</param>
 public void RemoveCropFromInventory(Crop crop)
 {
     CropInventory[crop.Name].Remove(crop);
 }
Esempio n. 3
0
 /// <summary>
 /// Adds a crop to the inventory
 /// </summary>
 /// <param name="crop">Crop to add to the inventory</param>
 public void AddCropToInventory(Crop crop)
 {
     CropInventory[crop.Name].Add(crop);
 }
Esempio n. 4
0
 /// <summary>
 /// Removes a crop from the inventory
 /// </summary>
 /// <param name="crop">Crop to remove from inventory</param>
 public void RemoveCropFromInventory(Crop crop)
 {
     CropInventory[crop.Name].Remove(crop);
 }
Esempio n. 5
0
 /// <summary>
 /// Adds a crop to the inventory
 /// </summary>
 /// <param name="crop">Crop to add to the inventory</param>
 public void AddCropToInventory(Crop crop)
 {
     CropInventory[crop.Name].Add(crop);
 }
Esempio n. 6
0
        /// <summary>
        /// Harvests a single crop from this seed
        /// </summary>
        /// <param name="index">Index of the crop to harvest</param>
        public void Harvest(int[] indexes)
        {
            Crop[] cropsToRemove = new Crop[indexes.Length];

              foreach(int i in indexes)
              {
            cropsToRemove[i - 1] = Crops[i - 1];
              }

              foreach(Crop crop in cropsToRemove)
              {
            Program.Game.AddCropToInventory(crop);
            Crops.Remove(crop);
              }

              if (Crops.Count == 0)
              {
            if (SeedType == Enumerations.SeedType.Vegetable)
              Field.RemoveSeed();
            else
              InitializeCrops();
              }
        }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new seed
 /// </summary>
 public Seed(string name, double baseSeedGrowth, Enumerations.SeedType seedType, Enumerations.Quality seedQuality, double requiredWater, Crop parentCrop, double optimalTemperature, int cropRate, double baseCropGrowth)
 {
     Name               = name;
     BaseSeedGrowth     = baseSeedGrowth;
     SeedGrowth         = 0;
     BaseCropGrowth     = baseCropGrowth;
     Age                = 0;
     Health             = 100.0;
     SeedType           = seedType;
     SeedQuality        = seedQuality;
     RequiredWaterBase  = requiredWater;
     Crops              = new List <Crop>();
     OptimalTemperature = optimalTemperature;
     _cropRate          = cropRate;
     ParentCrop         = parentCrop;
 }