health bar look at cam

This commit is contained in:
Sveske Juice 2024-04-21 01:19:08 +02:00
parent 9741ce2904
commit 585688b1e2
1 changed files with 5 additions and 0 deletions

View File

@ -11,6 +11,8 @@ public abstract class Tower : MonoBehaviour
protected HealthComponent healthComp; protected HealthComponent healthComp;
protected Outline outline; protected Outline outline;
protected Camera mainCam;
// Getters // Getters
public virtual void TowerSelected(bool selected) public virtual void TowerSelected(bool selected)
{ {
@ -26,6 +28,8 @@ public abstract class Tower : MonoBehaviour
outline = GetComponent<Outline>(); outline = GetComponent<Outline>();
Assert.IsNotNull(healthComp); Assert.IsNotNull(healthComp);
Assert.IsNotNull(outline); Assert.IsNotNull(outline);
mainCam = Camera.main;
} }
protected virtual void Start() protected virtual void Start()
@ -38,6 +42,7 @@ public abstract class Tower : MonoBehaviour
protected virtual void Update() protected virtual void Update()
{ {
selectedUI.transform.LookAt(mainCam.transform.position);
} }
protected virtual void FixedUpdate() protected virtual void FixedUpdate()