Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
 public void AddAbility(Research research)
 {
     AbilityBar.AddAbility(int.Parse(research.meta));
 }