public void FindParent() //associate each skill in skillsheet with its parent, for recursive calls later. { foreach (CascadiaSkill skill in mySkillSheet.mySkills) { if (skill.skillName == parentName) { cs_parent = skill; Debug.Log("Farmer: " + mySkillSheet.farmer.ToString() + " My Name: " + skillName + " My Parent: " + parentName); } } }
public void InitializeSkillbar() //called by clicking farmer portrait { skillSheet = GlobalVars.activeFarmer.GetComponent <SkillSheet>(); //Debug.Log(skillSheet.ToString()); foreach (CascadiaSkill skill in skillSheet.mySkills) { if (skill.skillName == mySkillName) { //Debug.Log("Found match. Linking " + skill.ToString() + " with value " + skill.skillValue.ToString() + " to " + this.ToString()); targetSkill = skill; //Debug.Log(targetSkill.ToString()); break; } } }
//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); } }