Exemplo n.º 1
0
    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;
        }
    }
Exemplo n.º 2
0
 private void UpdateHealth(object sender, System.EventArgs e)
 {
     healthSlider.value = ((float)playerHealth.GetHealth() / (float)playerHealth.maxHealth);
 }