Ejemplo n.º 1
0
    public override int quitarVida(int pupa)
    {
        if (pupa == 0)
        {
            return(health);
        }

        if (spicy > 0)
        {
            spicy--;
            enemy.quitarVidaPlana(pupa / 2);
            if (spicy == 0)
            {
                PS_spicy.Stop();
            }
        }

        if (defensa)
        {
            GameObject.Find("Shield").renderer.enabled = false;
            defensa = false;
            pupa    = pupa / 2;
        }
        if (Juggernaut > 0)
        {
            pupa = Mathf.RoundToInt(pupa * (1 - Juggernaut * 0.2f));
        }

        pupa             = Mathf.RoundToInt(pupa * resistencia);
        health           = health - pupa;
        healthBar.barMin = ((health * 1.0f) / (maxHealth * 1.0f));

        if (health <= 0)
        {
            controler.death();
        }
        else
        {
            controler.wound();
        }

        return(health);
    }