Exemplo n.º 1
0
    public void Heal(float healAmount)
    {
        currentHealth += Mathf.RoundToInt(healAmount);
        if (currentHealth > maxHealth)
        {
            SetCurrentHealthToMaxHealth();
        }

        if (PlayerPrefsController.DamagePopupsEnabled())
        {
            TextPopup.CreateHealPopup(transform.position + new Vector3(Random.Range(-0.05f, 0.05f), Random.Range(0.05f, 0.15f)), healAmount);
        }
    }
Exemplo n.º 2
0
    public void TakeHeal(float healAmount)
    {
        if (thisEntity.GetHPAmount() + healAmount >= thisEntity.GetHPmax())
        {
            thisEntity.SetHPAmount(thisEntity.GetHPmax());
        }
        else
        {
            thisEntity.SetHPAmount(thisEntity.GetHPAmount() + healAmount);
        }

        hpBar.UpdateHPBar(thisEntity.GetHPmax(), thisEntity.GetHPAmount());

        TextPopup.CreateHealPopup(transform.position, healAmount);
    }