Exemple #1
0
    public void OnClick()
    {
        switch (value)
        {
        case 1:     // Opens spell menu
            SpellMenu.SetActive(true);
            sfxMan.ButtonClick.Play();
            break;

        case 5:     // Heal spell
            if (playerHealth.playerCurrentMana >= 5)
            {
                playerHealth.ChangeMana(-5);
                bh.playerAction = value;
                sfxMan.ButtonClick.Play();
            }
            else
            {
                sfxMan.PurchaseDenied.Play();
            }
            break;

        case 6:     // Closes spell menu
            SpellMenu.SetActive(false);
            sfxMan.ButtonClick.Play();
            break;

        case 7:     // Attack spell
            if (playerHealth.playerCurrentMana >= 3)
            {
                playerHealth.ChangeMana(-3);
                bh.playerAction = value;
                sfxMan.ButtonClick.Play();
            }
            else
            {
                sfxMan.PurchaseDenied.Play();
            }
            break;

        case 8:     // Damage spell
            if (playerHealth.playerCurrentMana >= 7)
            {
                playerHealth.ChangeMana(-7);
                bh.playerAction = value;
                sfxMan.ButtonClick.Play();
            }
            else
            {
                sfxMan.PurchaseDenied.Play();
            }
            break;

        default:     // Other action
            bh.playerAction = value;
            sfxMan.ButtonClick.Play();
            break;
        }
    }