Esempio n. 1
0
    public void HealPlayer(float healAmount)
    {
        if (isAlive && currentHealth > 0)
        {
            currentHealth += healAmount;
            healthBar.SetHealth(currentHealth);
            if (TextPopupsHandler)
            {
                Vector3 tempPos = transform.position;
                tempPos += TPOffset;

                /*Vector3 tempPos1 = PlayerHealthBar.position;
                 * tempPos1 += new Vector3(0, -.5f, 0);*/
                TextPopupsHandler.ShowHeal(healAmount, tempPos);
            }
            if (currentHealth > maxHealth)
            {
                currentHealth = maxHealth; //don't overheal
            }
        }
    }
Esempio n. 2
0
    public virtual void GetHealed(float healAmount)
    {
        if (isAlive && currentHealth < maxHealth)
        {
            currentHealth += healAmount;
            healthBar.SetHealth(currentHealth); //update health bar
            if (currentHealth > maxHealth)      //prevent overhealing
            {
                currentHealth = maxHealth;
            }

            if (TextPopupsHandler)
            {
                Vector3 tempPos = transform.position;
                tempPos.y += TPOffset;
                TextPopupsHandler.ShowHeal(healAmount, tempPos);
            }
        }
    }
Esempio n. 3
0
    public void TakeHeal(float healAmount) //TODO: move to controller
    {
        if (isAlive && maxHeal > 0 && currentHealth < maxHealth)
        {
            maxHeal       -= healAmount;        //enemy can only heal this amount total
            currentHealth += healAmount;
            healthBar.SetHealth(currentHealth); //update health bar
            if (currentHealth > maxHealth)      //prevent overhealing
            {
                currentHealth = maxHealth;
            }

            if (TextPopupsHandler)
            {
                Vector3 tempPos = transform.position;
                tempPos += TPOffset;
                TextPopupsHandler.ShowHeal(healAmount, tempPos);
            }
        }
    }