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 } } }
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); } } }
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); } } }