/// <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; }
/// <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); }
/// <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); }
/// <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(); } }
/// <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; }