void UpdateHealth()
    {
        var hp = _healthComp.GetHealth();

        if (hp >= _healthComp.GetMaxHealth())
        {
            _panel.fillAmount = minFillValue;
        }

        if (hp < _healthComp.GetMaxHealth())
        {
            var amt = hp * fillAddValue;

            _panel.fillAmount = _panel.fillAmount + amt;
        }
    }
Example #2
0
 private void UpdateHealth(object sender, System.EventArgs e)
 {
     healthSlider.value = ((float)playerHealth.GetHealth() / (float)playerHealth.maxHealth);
 }