public bool Equals(DictPerk other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(other.PerkName == PerkName && other.CardinalName == CardinalName); }
public bool AddPerk(string perkName, string cardinalName) { if (partyBuilder.DemoPerkCount == 15) { StartCoroutine(UnitCreatorNotice(maxPartyNotice.gameObject)); return(false); } partyBuilder.DemoPerkCount++; DictPerk dp = new DictPerk(perkName, cardinalName); unitPerkDict[dp] = true; fallBackPerkDesc = descriptionDict[perkName]; perkText.text = descriptionDict[perkName]; UnitFactory.AddPerk(unit, cardinalName, perkName); ++UnitLevel; RefreshPerkTree(); StatSheetPerkHover(perkName); RefreshStatSheet(); return(true); }
public void RemovePerk(string perkName, string cardinalName) { partyBuilder.DemoPerkCount--; DictPerk dp = new DictPerk(perkName, cardinalName); unitPerkDict[dp] = false; foreach (Perk p in unit.GetComponentsInChildren <Perk>()) { if (p.perkName == perkName) { p.UnloadDefaultStats(); p.UnEmploy(); Destroy(p.gameObject); if (cardinals.Contains(perkName)) { cardinalName = ""; perkText.text = ""; cardinalText.text = ""; fallBackPerkDesc = ""; fallBackCardinalDesc = ""; ResetPerkTree(); } if (unit.GetComponentsInChildren <Perk>().Length - 1 == 1) { //TODO: add a coroutine to allow a wait period after resetting perkDesc if (cardinalName != "") { SetPerkDesc(cardinalName); } else { SetPerkDesc(""); } } } } --UnitLevel; RefreshPerkTree(); StatSheetPerkHover(perkName); RefreshStatSheet(); }
private void PopulateDictionaries() { descriptionDict.Clear(); unitPerkDict.Clear(); foreach (TextAsset txt in Resources.LoadAll("Texts/")) { descriptionDict.Add(txt.name, txt.text); } foreach (TextAsset txt in Resources.LoadAll("Texts/Perks/Adept/")) { DictPerk dp = new DictPerk(txt.name.Trim(new char[] { '_' }), "Adept"); //Debug.Log(dp.PerkName + ", " + dp.CardinalName); unitPerkDict.Add(dp, false); } foreach (TextAsset txt in Resources.LoadAll("Texts/Perks/Healer/")) { DictPerk dp = new DictPerk(txt.name.Trim(new char[] { '_' }), "Healer"); //Debug.Log(dp.PerkName + ", " + dp.CardinalName); unitPerkDict.Add(dp, false); } foreach (TextAsset txt in Resources.LoadAll("Texts/Perks/Levy/")) { DictPerk dp = new DictPerk(txt.name.Trim(new char[] { '_' }), "Levy"); //Debug.Log(dp.PerkName + ", " + dp.CardinalName); unitPerkDict.Add(dp, false); } foreach (TextAsset txt in Resources.LoadAll("Texts/Perks/Rogue/")) { DictPerk dp = new DictPerk(txt.name.Trim(new char[] { '_' }), "Rogue"); //Debug.Log(dp.PerkName + ", " + dp.CardinalName); unitPerkDict.Add(dp, false); } }