public void ApplyAbilityXp(float xp) { for (int i = 0; i < abilities.Count; i++) { if (abilities[i]) { // add the xp abilityXP[i] += xp; // check if any abilities have levelled up bool levelledAbility = true; int j = 0; while (j < 20 && levelledAbility) { j++; levelledAbility = false; while (SpecialisedAbilityManager.getAbilityLevel(abilityXP[i]) > abilityLevels[i]) { levelUpAbility(i); levelledAbility = true; } } } } }
// Use this for initialization void Awake() { while (abilities.Count < 5) { abilities.Add(null); abilityLevels.Add(0); abilityXP.Add(0); } // get a reference to the level up skills button levelUpButton = FindObjectOfType <LevelUpSkillsButton>(); // set the number of unlocked slots numberOfUnlockedSlots = SpecialisedAbilityManager.getNumberOfSpecialisationSlots(GetComponent <CharacterStats>().level); }
public void loadAbility(string playerAbilityID, int slotNumber, float abilityXP, int unspentPoints, List <StringIntPair> nodesTaken) { UIBase uiBase = UIBase.instance; uiBase.openSkills(); // specialised in the ability SpecialisedAbilityList specialisedAbilityList = PlayerFinder.getPlayer().GetComponent <SpecialisedAbilityList>(); specialisedAbilityList.Specialise(AbilityIDList.getPlayerAbility(playerAbilityID), slotNumber, false); // set the ability xp specialisedAbilityList.abilityXP[slotNumber] = abilityXP; // set the ability level specialisedAbilityList.abilityLevels[slotNumber] = SpecialisedAbilityManager.getAbilityLevel(abilityXP); // update the tree loadTree(playerAbilityID, unspentPoints, 0, nodesTaken); uiBase.closeSkills(); }
// Use this for initialization void Start() { SpecialisedAbilityManager.instance = this; }