private void LevelUp() { AudioManager.Instance.PlayAudioClip("LevelUp"); damageTakenCanvas.InitializeLevelUpText(); level++; experience -= nextLevel; if (experience < 0) { experience = 0; } LevelUpPackage package = GetComponent <LevelingData>().GetLevelStats(level, nextLevel); Debug.Log("old next level: " + nextLevel); nextLevel = package.nextLevel; MaxHealth += package.healthUp; if (package.ability != null) { AbilityStruct newAbil = new AbilityStruct(package.ability); newAbil.instance = Instantiate(newAbil.prefab); ability.Add(newAbil); bar.AddAbility(newAbil.instance); //demoProjectile = package.projectile; } ChangeHealth(MaxHealth); OnPlayerLvlUp(); OnExperienceGained(experience, nextLevel); Debug.Log("Level up! You are now level " + level + "! XP until next level: " + nextLevel); }
public void AddAbility(Research research) { AbilityBar.AddAbility(int.Parse(research.meta)); }