File was renamed from Assets/Scripts/UI/HealthDisplay.cs |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | public class HealthDisplay : MonoBehaviour |
| | | public class PlayerDisplay : MonoBehaviour |
| | | { |
| | | private GameObject _playerGO; |
| | | private Damageable playerDamage; |
| | | public TextMeshProUGUI healthText; |
| | | public TextMeshProUGUI depthMeterText; |
| | | public Slider healthSlider; |
| | | |
| | | public GameObject PlayerGO |
| | |
| | | healthText.text = "Health: " + playerDamage.Health; |
| | | healthSlider.value = (float)playerDamage.Health / (float)playerDamage.MaxHealth; |
| | | //healthImage.rectTransform.sizeDelta = new Vector2(originalRect.width * ((float)playerDamage.Health / (float)playerDamage.MaxHealth), originalRect.height); |
| | | depthMeterText.text = $"Y: {Mathf.CeilToInt(_playerGO.transform.position.y)}"; |
| | | } |
| | | } |