public void changeSpecialisation(string newPlayerAbilityID, int slotNumber, string oldPlayerAbilityID = "") { CharacterData data = PlayerFinder.getPlayer().GetComponent <CharacterDataTracker>().charData; // remove the old tree if an old PlayerAbilityID is given if (oldPlayerAbilityID != "") { CharacterData.SavedSkillTree treeToRemove = null; foreach (CharacterData.SavedSkillTree tree in data.savedSkillTrees) { if (tree.treeID == oldPlayerAbilityID) { treeToRemove = tree; } } if (treeToRemove == null) { Debug.LogError("Failed to remove saved tree with id " + oldPlayerAbilityID); } else { data.savedSkillTrees.Remove(treeToRemove); } } // save the new ability data.savedSkillTrees.Add(new CharacterData.SavedSkillTree(newPlayerAbilityID, slotNumber, 0, 1)); }
public void despecialise(string oldPlayerAbilityID) { CharacterData data = PlayerFinder.getPlayer().GetComponent <CharacterDataTracker>().charData; if (oldPlayerAbilityID != "") { CharacterData.SavedSkillTree treeToRemove = null; foreach (CharacterData.SavedSkillTree tree in data.savedSkillTrees) { if (tree.treeID == oldPlayerAbilityID) { treeToRemove = tree; } } if (treeToRemove == null) { Debug.LogError("Failed to remove saved tree with id " + oldPlayerAbilityID); } else { data.savedSkillTrees.Remove(treeToRemove); } } }