From 7af00d5d167c061457182913c43719b96d8a4076 Mon Sep 17 00:00:00 2001
From: maikeljh <mjh191003@gmail.com>
Date: Sat, 11 May 2024 00:02:51 +0700
Subject: [PATCH] [Fix] Retry Game

---
 Assets/Scripts/Managers/GameOverManager.cs | 2 +-
 Assets/Scripts/Managers/LevelManager.cs    | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Assets/Scripts/Managers/GameOverManager.cs b/Assets/Scripts/Managers/GameOverManager.cs
index 37bc7de..9f46105 100644
--- a/Assets/Scripts/Managers/GameOverManager.cs
+++ b/Assets/Scripts/Managers/GameOverManager.cs
@@ -45,7 +45,7 @@ namespace Nightmare
 
         public void ResetLevel()
         {
-            DataPersistenceManager.instance.NewGame();
+            DataPersistenceManager.instance.RetryGame(0);
             LevelManager.Instance.ResetLevel();
             isGameOver = false;
             statsManager.SaveStats();
diff --git a/Assets/Scripts/Managers/LevelManager.cs b/Assets/Scripts/Managers/LevelManager.cs
index fcb5fc7..6302554 100644
--- a/Assets/Scripts/Managers/LevelManager.cs
+++ b/Assets/Scripts/Managers/LevelManager.cs
@@ -473,6 +473,7 @@ namespace Nightmare
 
         public void LoadScene()
         {
+            Debug.Log("CURRENT INDEX "+ currentIndex);
             if (levels[currentIndex].StartsWith("Cutscene"))
             {
                 bool skip = true;
@@ -647,10 +648,11 @@ namespace Nightmare
 
         public void ResetLevel()
         {
-            currentIndex = 1;
+            currentIndex = 0;
             currentQuest = 0;
             ResetAtt();
             SceneManager.LoadScene(levels[currentIndex], LoadSceneMode.Single);
+            Next();
         }
 
         public void ResetAtt()
-- 
GitLab