From 585688b1e259bdb9a81e081619f364e8fb33ac11 Mon Sep 17 00:00:00 2001 From: Sveske Juice Date: Sun, 21 Apr 2024 01:19:08 +0200 Subject: [PATCH] health bar look at cam --- Assets/Scripts/Tower/Tower.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Assets/Scripts/Tower/Tower.cs b/Assets/Scripts/Tower/Tower.cs index e7386f5..d6d582b 100644 --- a/Assets/Scripts/Tower/Tower.cs +++ b/Assets/Scripts/Tower/Tower.cs @@ -11,6 +11,8 @@ public abstract class Tower : MonoBehaviour protected HealthComponent healthComp; protected Outline outline; + protected Camera mainCam; + // Getters public virtual void TowerSelected(bool selected) { @@ -26,6 +28,8 @@ public abstract class Tower : MonoBehaviour outline = GetComponent(); Assert.IsNotNull(healthComp); Assert.IsNotNull(outline); + + mainCam = Camera.main; } protected virtual void Start() @@ -38,6 +42,7 @@ public abstract class Tower : MonoBehaviour protected virtual void Update() { + selectedUI.transform.LookAt(mainCam.transform.position); } protected virtual void FixedUpdate()