/// <summary> /// Mutates the plant instance this is run against /// </summary> /// <param name="_PlantData.plantEvolveStats"></param> public void MutateTo(PlantData _PlantData) { if (_PlantData.plantEvolveStats == null) { return; } Plantname = _PlantData.Plantname; Description = _PlantData.Description; Name = _PlantData.Name; ProduceObject = _PlantData.ProduceObject; GrowthSpritesSOs = _PlantData.GrowthSpritesSOs; FullyGrownSpriteSO = _PlantData.FullyGrownSpriteSO; DeadSpriteSO = _PlantData.DeadSpriteSO; MutatesInToGameObject = _PlantData.MutatesInToGameObject; WeedResistance = WeedResistance + _PlantData.plantEvolveStats.WeedResistanceChange; WeedGrowthRate = WeedGrowthRate + _PlantData.plantEvolveStats.WeedGrowthRateChange; GrowthSpeed = GrowthSpeed + _PlantData.plantEvolveStats.GrowthSpeedChange; Potency = Mathf.Clamp(Potency + _PlantData.plantEvolveStats.PotencyChange, 0, MAX_POTENCY); Endurance = Endurance + _PlantData.plantEvolveStats.EnduranceChange; Yield = Yield + _PlantData.plantEvolveStats.YieldChange; Lifespan = Lifespan + _PlantData.plantEvolveStats.LifespanChange; PlantTrays = (_PlantData.plantEvolveStats.PlantTrays.Union(PlantTrays)).ToList(); CombineReagentProduction(_PlantData.plantEvolveStats.ReagentProduction); }
/// <summary> /// Mutates the plant instance this is run against /// </summary> /// <param name="plantData"></param> public void MutateTo(PlantData plantData) { if (plantData.plantEvolveStats == null) { return; } PlantName = plantData.PlantName; ProduceObject = plantData.ProduceObject; GrowthSpritesSOs = plantData.GrowthSpritesSOs; FullyGrownSpriteSO = plantData.FullyGrownSpriteSO; DeadSpriteSO = plantData.DeadSpriteSO; MutatesInToGameObject = plantData.MutatesInToGameObject; var evolveStats = plantData.plantEvolveStats; WeedResistance = AddToStat(WeedResistance, evolveStats.WeedResistanceChange); WeedGrowthRate = AddToStat(WeedGrowthRate, evolveStats.WeedGrowthRateChange); GrowthSpeed = AddToStat(GrowthSpeed, evolveStats.GrowthSpeedChange); Potency = AddToStat(Potency, evolveStats.PotencyChange); Endurance = AddToStat(Endurance, evolveStats.EnduranceChange); Yield = AddToStat(Yield, evolveStats.YieldChange); Lifespan = AddToStat(Lifespan, evolveStats.LifespanChange); PlantTrays = (evolveStats.PlantTrays.Union(PlantTrays)).ToList(); CombineReagentProduction(evolveStats.ReagentProduction); }
/// <summary> /// Gets a new instance of PlantData based on param /// </summary> /// <param name="plantData">PlantData to copy</param> /// <returns></returns> public static PlantData CreateNewPlant(PlantData plantData) { PlantData newPlant = new PlantData(); newPlant.SetValues(plantData); newPlant.Health = 100; newPlant.Age = 0; return(newPlant); }
/// <summary> /// Called when plant creates food /// </summary> public void SetUpFood(PlantData newPlantData, PlantTrayModification modification) { plantData = PlantData.MutateNewPlant(newPlantData, modification); SyncSize(sizeScale, 0.5f + (newPlantData.Potency / 200f)); SetupChemicalContents(); if (edible != null) { SetupEdible(); } }
public static PlantData MutateNewPlant(PlantData plantData, PlantTrayModification modification) { PlantData newPlant = new PlantData(); newPlant.SetValues(plantData); newPlant.Health = 100; newPlant.Age = 0; newPlant.NaturalMutation(modification); return(newPlant); }
public PlantData GetPlantData() { PlantData _plantData = null; if (plantData.FullyGrownSpriteSO == null) { _plantData = SeedPacket.GetComponent <SeedPacket>().plantData; } else { _plantData = plantData; } return(_plantData); }
/// <summary> /// Initializes plant with data another plant object /// </summary> /// <param name="_PlantData">data to copy</param> private void SetValues(PlantData _PlantData) { PlantName = _PlantData.PlantName; ProduceObject = _PlantData.ProduceObject; GrowthSpritesSOs = _PlantData.GrowthSpritesSOs; FullyGrownSpriteSO = _PlantData.FullyGrownSpriteSO; DeadSpriteSO = _PlantData.DeadSpriteSO; WeedResistance = _PlantData.WeedResistance; WeedGrowthRate = _PlantData.WeedGrowthRate; GrowthSpeed = _PlantData.GrowthSpeed; Potency = _PlantData.Potency; Endurance = _PlantData.Endurance; Yield = _PlantData.Yield; Lifespan = _PlantData.Lifespan; PlantTrays = _PlantData.PlantTrays; ReagentProduction = _PlantData.ReagentProduction; MutatesInToGameObject = _PlantData.MutatesInToGameObject; }
public void SetPlantData(PlantData newData) { plantData = newData; }