From ccfc23c5fc0d00898220205c7d65562c2aac6da6 Mon Sep 17 00:00:00 2001 From: maikeljh <mjh191003@gmail.com> Date: Fri, 10 May 2024 02:34:49 +0700 Subject: [PATCH] [Fix] Reward --- Assets/Scripts/DataUtils/GameData.cs | 3 +++ Assets/Scripts/Managers/DataPersistenceManager.cs | 1 - Assets/Scripts/ShopKeeper/TimerScript.cs | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/DataUtils/GameData.cs b/Assets/Scripts/DataUtils/GameData.cs index 7ad37e9..35aef94 100644 --- a/Assets/Scripts/DataUtils/GameData.cs +++ b/Assets/Scripts/DataUtils/GameData.cs @@ -22,6 +22,7 @@ public class GameData public string timestamp; public bool isShopKeeper; public float increment; + public int currentReward; // Constructor buat default values kalau new game public GameData() @@ -42,6 +43,7 @@ public class GameData this.timestamp = string.Empty; this.isShopKeeper = false; this.increment = 50; + this.currentReward = 1; } public GameData(int currentScene) @@ -62,6 +64,7 @@ public class GameData this.timestamp = string.Empty; this.isShopKeeper = false; this.increment = 50; + this.currentReward = 1; } } diff --git a/Assets/Scripts/Managers/DataPersistenceManager.cs b/Assets/Scripts/Managers/DataPersistenceManager.cs index a7fabd9..1019d91 100644 --- a/Assets/Scripts/Managers/DataPersistenceManager.cs +++ b/Assets/Scripts/Managers/DataPersistenceManager.cs @@ -166,7 +166,6 @@ public class DataPersistenceManager : MonoBehaviour for (int i = dataPersistenceList.Count-1; i >= 0; i--) { dataPersistenceList[i].LoadData(gameData); - Debug.Log(dataPersistenceList[i].ToString()); } Debug.Log("Load Game called"); diff --git a/Assets/Scripts/ShopKeeper/TimerScript.cs b/Assets/Scripts/ShopKeeper/TimerScript.cs index a571c52..c6d0f69 100644 --- a/Assets/Scripts/ShopKeeper/TimerScript.cs +++ b/Assets/Scripts/ShopKeeper/TimerScript.cs @@ -13,13 +13,11 @@ public class TimerScript : MonoBehaviour, IDataPersistence void Start() { - ResetTimer(); StartTimerCountDown(); } void OnEnable() { - ResetTimer(); StartTimerCountDown(); } @@ -51,6 +49,7 @@ public class TimerScript : MonoBehaviour, IDataPersistence shopCanvas.gameObject.SetActive(false); shopInstructionCanvas.gameObject.SetActive(false); StopTimerCountDown(); + ResetTimer(); } private void UpdateTimerDisplay() -- GitLab