16 lines
406 B
C#
16 lines
406 B
C#
using UnityEngine;
|
|
using TMPro;
|
|
using UnityEngine.UI;
|
|
|
|
public class PlayerHealthView : MonoBehaviour
|
|
{
|
|
[SerializeField] private TMP_Text healthText;
|
|
[SerializeField] private Image healthBar;
|
|
|
|
public void UpdateHealth(int _currentHealth, int _maxHealth)
|
|
{
|
|
healthText.text = $"{_currentHealth}/{_maxHealth}";
|
|
healthBar.fillAmount = (float)_currentHealth / _maxHealth;
|
|
}
|
|
}
|