From 85b5937db82b710d87118ac720c42cfd98f09d96 Mon Sep 17 00:00:00 2001
From: Daffa Romyz Aufa <80190953+DaffaRomyz@users.noreply.github.com>
Date: Sun, 16 Apr 2023 07:45:25 +0700
Subject: [PATCH] feat : load gameover scene if died

---
 Assets/Scripts/Managers/GameOverManager.cs | 49 +++++++++++-----------
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/Assets/Scripts/Managers/GameOverManager.cs b/Assets/Scripts/Managers/GameOverManager.cs
index a1786ef2..92e70281 100755
--- a/Assets/Scripts/Managers/GameOverManager.cs
+++ b/Assets/Scripts/Managers/GameOverManager.cs
@@ -4,28 +4,29 @@ using UnityEngine.SceneManagement;
 
 public class GameOverManager : MonoBehaviour
 {
-    public Text warningText;
-    public PlayerHealth playerHealth;
- 
-    Animator anim;
- 
-    void Awake()
-    {
-        anim = GetComponent<Animator>();
-    }
- 
-    void Update()
-    {
-        if (playerHealth.currentHealth <= 0)
-        {
-            anim.SetTrigger("GameOver");
-        }
-    }
- 
-    public void ShowWarning(float enemyDistance)
-    {
-    	Debug.Log("SHOWWARNING");
-        warningText.text = string.Format("! {0} m",Mathf.RoundToInt(enemyDistance));
-        anim.SetTrigger("Warning");
-    }
+    public Text warningText;
+    public PlayerHealth playerHealth;
+
+    Animator anim;
+
+    void Awake()
+    {
+        anim = GetComponent<Animator>();
+    }
+
+    void Update()
+    {
+        if (playerHealth.currentHealth <= 0)
+        {
+            //anim.SetTrigger("GameOver");
+            SceneManager.LoadScene("GameOverScene");
+        }
+    }
+
+    public void ShowWarning(float enemyDistance)
+    {
+        Debug.Log("SHOWWARNING");
+        warningText.text = string.Format("! {0} m", Mathf.RoundToInt(enemyDistance));
+        anim.SetTrigger("Warning");
+    }
 }
-- 
GitLab