Exemplo n.º 1
0
    public void Win()
    {
        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();

        win = true;
        CheckMusic music = FindObjectOfType <CheckMusic>();

        music.EndBattleMusic();
        if (stats.tipoIncontro == 0)
        {
            int lvlTot = 0;
            foreach (var item in enemyLvl)
            {
                lvlTot += item;
            }

            int  exp    = Mathf.RoundToInt((lvlTot * (Random.Range(3.0f, 5.0f))) * Random.Range(1.0f, 1.25f) * 10);
            int  sangue = Mathf.RoundToInt((lvlTot * (Random.Range(2.0f, 4.0f))) * Random.Range(1.0f, 1.25f) * 10);
            bool health = false;
            if (Random.Range(0f, 100f) > 90f)
            {
                health = true;
                stats.nPotionHealth++;
            }

            bool mana = false;
            if (Random.Range(0f, 100f) > 90f)
            {
                mana = true;
                stats.nPotionMana++;
            }

            UiController ui = FindObjectOfType <UiController>();
            StartCoroutine(ui.EndPanel(stats.esperience, exp, stats.soldi, sangue, health, mana));

            Player[] players = FindObjectsOfType <Player>();

            foreach (var item in players)
            {
                item.EndBattle();
            }

            stats.esperience += exp;
            stats.soldi      += sangue;
        }
        if (stats.tipoIncontro == 1)
        {
            stats.boss[1] = true;
            int  exp    = 2000;
            int  sangue = 1000;
            bool health = true;
            bool mana   = true;
            stats.nPotionHealth++;
            stats.nPotionHealth++;

            UiController ui = FindObjectOfType <UiController>();
            StartCoroutine(ui.EndPanel(stats.esperience, exp, stats.soldi, sangue, health, mana));

            Player[] players = FindObjectsOfType <Player>();

            foreach (var item in players)
            {
                item.EndBattle();
            }

            stats.esperience += exp;
            stats.soldi      += sangue;
        }
        if (stats.tipoIncontro == 2)
        {
            stats.boss[2] = true;
            int  exp    = 5000;
            int  sangue = 2500;
            bool health = true;
            bool mana   = true;
            stats.nPotionHealth++;
            stats.nPotionHealth++;

            UiController ui = FindObjectOfType <UiController>();
            StartCoroutine(ui.EndPanel(stats.esperience, exp, stats.soldi, sangue, health, mana));

            Player[] players = FindObjectsOfType <Player>();

            foreach (var item in players)
            {
                item.EndBattle();
            }

            stats.esperience += exp;
            stats.soldi      += sangue;
        }
        if (stats.tipoIncontro == 3)
        {
            stats.boss[3] = true;
            int  exp    = 10000;
            int  sangue = 5000;
            bool health = true;
            bool mana   = true;
            stats.nPotionHealth++;
            stats.nPotionHealth++;

            UiController ui = FindObjectOfType <UiController>();
            StartCoroutine(ui.EndPanel(stats.esperience, exp, stats.soldi, sangue, health, mana));

            Player[] players = FindObjectsOfType <Player>();

            foreach (var item in players)
            {
                item.EndBattle();
            }

            stats.esperience += exp;
            stats.soldi      += sangue;
        }
        if (stats.tipoIncontro == 4)
        {
            SceneManager.LoadScene("CutScene");
        }
    }
Exemplo n.º 2
0
 private void Awake()
 {
     instance = this;
     ApplySavedMusic();
 }