This commit is contained in:
Crizomb 2025-01-29 00:59:22 +01:00
parent a17810ffeb
commit 4e91f448c9
826 changed files with 66 additions and 8 deletions

View file

@ -0,0 +1,23 @@
using UnityEngine;
using UnityEngine.UI;
public class HealthBar : MonoBehaviour
{
[SerializeField] private HealthHandler healthHandler;
[SerializeField] private Slider healthSlider;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
healthSlider.maxValue = healthHandler.MaxHealth;
}
void Update()
{
healthSlider.value = healthHandler.CurrentHealth;
}
// Update is called once per frame
void LateUpdate()
{
transform.LookAt(Camera.main.transform);
}
}