public void LoadState(ObjectAttachmentState state) { PerksContainerState perksState = state as PerksContainerState; // RemoveAllPerks (); for (int i = 0; i < perksState.perksSaved.Count; i++) { string[] split = perksState.perksSaved[i].Split(splitKey, StringSplitOptions.RemoveEmptyEntries); AddPerk(PerksCollection.GetPerk(split[0]), int.Parse(split[1])); } }
public static void RefreshPerksList() { if (Application.isPlaying) { return; } PerksCollection instance = PerksCollection.instance; // dont update when in play mode or if our game settings object is missing if (instance == null) { return; } // update the array of all game settings objects in the project Perk[] allScenesInProject = AssetTools.FindAssetsByType <Perk>(log: false, null).ToArray(); instance.allPerks = allScenesInProject; for (int i = 0; i < allScenesInProject.Length; i++) { for (int j = i + 1; j < allScenesInProject.Length; i++) { if (allScenesInProject[i].name == allScenesInProject[j].name) { Debug.LogError("Perks with duplicate names: " + allScenesInProject[i].name); } } } for (int i = 0; i < allScenesInProject.Length; i++) { for (int j = i + 1; j < allScenesInProject.Length; i++) { if (allScenesInProject[i].displayName == allScenesInProject[j].displayName) { Debug.LogError("Perks with duplicate display names: " + allScenesInProject[i].displayName); } } } EditorUtility.SetDirty(instance); }
public void RemovePerk(string perk) { RemovePerk(PerksCollection.GetPerk(perk)); }
public PerkHolder AddPerk(string perk) { return(AddPerk(PerksCollection.GetPerk(perk))); }
public PerkHolder SetPerkLevel(string perk, int level) { return(SetPerkLevel(PerksCollection.GetPerk(perk), level)); }
public PerkHolder AddToPerkLevel(string perk, int amount) { return(AddToPerkLevel(PerksCollection.GetPerk(perk), amount)); }
public int GetPerkLevel(string perk) { return(GetPerkLevel(PerksCollection.GetPerk(perk))); }
public bool PerkMaxedOut(string perk) { return(PerkMaxedOut(PerksCollection.GetPerk(perk))); }