public void FillSkills() { //Debug.Log("mySkills started with " + mySkills.Count + " entries."); CS_Botany botany = new CS_Botany(); botany.mySkillSheet = thisSkillSheet; mySkills.Add(botany); CS_Shrubs shrubs = new CS_Shrubs(); shrubs.mySkillSheet = thisSkillSheet; mySkills.Add(shrubs); CS_FoodBearing foodBearing = new CS_FoodBearing(); foodBearing.mySkillSheet = thisSkillSheet; mySkills.Add(foodBearing); CS_RootVegetables rootVegetables = new CS_RootVegetables(); rootVegetables.mySkillSheet = thisSkillSheet; mySkills.Add(rootVegetables); CS_Carrots carrots = new CS_Carrots(); carrots.mySkillSheet = thisSkillSheet; mySkills.Add(carrots); CS_Harvesting harvesting = new CS_Harvesting(); harvesting.mySkillSheet = thisSkillSheet; mySkills.Add(harvesting); //harvesting.HarvestCarrots(10, 20, 30); //Debug.Log("mySkills now contains " + mySkills.Count + " entries."); }
//bad, hardcoded harvest call. This is written as if all each farmer does each round is harvest. public void TriggerHarvest() { foreach (GameObject farmer in GameObject.FindGameObjectsWithTag("Player")) { List <CascadiaSkill> temp = farmer.GetComponent <SkillSheet>().mySkills; CS_Harvesting temp_harvest = (CS_Harvesting)temp.Find(c => c.skillName == "Harvesting"); CascadiaSkill botany = temp.Find(c => c.skillName == "Botany"); CascadiaSkill carrots = temp.Find(c => c.skillName == "Carrots"); CascadiaSkill foodBearing = temp.Find(c => c.skillName == "Food Bearing"); CascadiaSkill shrubs = temp.Find(c => c.skillName == "Shrubs"); CascadiaSkill rootVegetables = temp.Find(c => c.skillName == "Root Vegetables"); int maxCarrots = farmer.GetComponent <Farmer>().currentPlot.GetComponent <Plot>().localCarrots; int harvestedCarrots = temp_harvest.HarvestCarrots(carrots.skillValue, rootVegetables.skillValue, foodBearing.skillValue, shrubs.skillValue, botany.skillValue, maxCarrots); farmer.GetComponent <Farmer>().currentPlot.GetComponent <Plot>().localCarrots -= harvestedCarrots; Debug.Log("Carrots before harvest: " + GlobalVars.carrotStockpile); GlobalVars.carrotStockpile += harvestedCarrots; Debug.Log("Carrots after harvest: " + GlobalVars.carrotStockpile); } }