From e062535dc9259da97953040e231a0c0bc7ce6821 Mon Sep 17 00:00:00 2001
From: billc27 <110593711+billc27@users.noreply.github.com>
Date: Thu, 9 May 2024 15:25:46 +0700
Subject: [PATCH] fix: health slider bug (restore health orb)

---
 Assets/Scripts/Orbs/RestoreHealthOrbs.cs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Assets/Scripts/Orbs/RestoreHealthOrbs.cs b/Assets/Scripts/Orbs/RestoreHealthOrbs.cs
index 150264c..b3a72da 100644
--- a/Assets/Scripts/Orbs/RestoreHealthOrbs.cs
+++ b/Assets/Scripts/Orbs/RestoreHealthOrbs.cs
@@ -2,14 +2,17 @@ using Nightmare;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
+using UnityEngine.UI;
 
 public class RestoreHealthOrbs : Orbs
 {
     PlayerHealth playerHealth;
+    Slider healthSlider;
 
     public override void Start()
     {
         playerHealth = GameObject.Find("Player").GetComponent<PlayerHealth>();
+        healthSlider = GameObject.Find("HealthSlider").GetComponent<Slider>();
 
         // Destroy object after 5 seconds
         Destroy(gameObject, 5f);
@@ -23,6 +26,9 @@ public class RestoreHealthOrbs : Orbs
             playerHealth.currentHealth = 100;
         }
 
+        // Set Health Slider
+        healthSlider.value = playerHealth.currentHealth;
+
         // Destroy the orb
         Destroy(gameObject);
     }
-- 
GitLab