From 2c34e2454ea3b8cb444ec0ff33800ab71fcc7d24 Mon Sep 17 00:00:00 2001 From: maikeljh <mjh191003@gmail.com> Date: Fri, 10 May 2024 12:25:19 +0700 Subject: [PATCH] [Fix] Coins --- Assets/Scripts/DataUtils/GameData.cs | 3 --- Assets/Scripts/Managers/RewardManager.cs | 11 ++--------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/Assets/Scripts/DataUtils/GameData.cs b/Assets/Scripts/DataUtils/GameData.cs index 35aef94..7ad37e9 100644 --- a/Assets/Scripts/DataUtils/GameData.cs +++ b/Assets/Scripts/DataUtils/GameData.cs @@ -22,7 +22,6 @@ public class GameData public string timestamp; public bool isShopKeeper; public float increment; - public int currentReward; // Constructor buat default values kalau new game public GameData() @@ -43,7 +42,6 @@ public class GameData this.timestamp = string.Empty; this.isShopKeeper = false; this.increment = 50; - this.currentReward = 1; } public GameData(int currentScene) @@ -64,7 +62,6 @@ public class GameData this.timestamp = string.Empty; this.isShopKeeper = false; this.increment = 50; - this.currentReward = 1; } } diff --git a/Assets/Scripts/Managers/RewardManager.cs b/Assets/Scripts/Managers/RewardManager.cs index e3d164f..cbc381d 100644 --- a/Assets/Scripts/Managers/RewardManager.cs +++ b/Assets/Scripts/Managers/RewardManager.cs @@ -7,27 +7,20 @@ public class RewardManager : MonoBehaviour, IDataPersistence { public PlayerCoin coins; public float increment = 50; - public int currentReward = 1; public void Reward() { - if (LevelManager.Instance.currentQuest >= currentReward) - { - coins.coin += increment; - increment += 50; - currentReward = LevelManager.Instance.currentQuest + 1; - } + coins.coin += increment; + increment += 50; } public void LoadData(GameData data) { this.increment = data.increment; - this.currentReward = data.currentReward; } public void SaveData(ref GameData data) { data.increment = this.increment; - data.currentReward = this.currentReward; } } -- GitLab