From 95394ceb58a3e530423dac298aee862dec2e363f Mon Sep 17 00:00:00 2001 From: Ali Sharoz Date: Tue, 19 Nov 2024 12:30:39 +0500 Subject: [PATCH] Default Effect --- Assets/ShopManager.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Assets/ShopManager.cs b/Assets/ShopManager.cs index 98000d44..81dd858e 100644 --- a/Assets/ShopManager.cs +++ b/Assets/ShopManager.cs @@ -69,13 +69,23 @@ public class ShopManager : MonoBehaviour, IDetailedStoreListener } private void Start() { + EffectDefaulter(); int coins = PlayerPrefs.GetInt("Coin"); coinTxt.text = coins.ToString(); SetupBuilder(); PipePrefGetter(); EffectPrefGetter(); } - + void EffectDefaulter() + { + if(PlayerPrefs.HasKey("EffectButtonIsEquipped")==false) + { + PlayerPrefs.SetInt("Coin", PlayerPrefs.GetInt("Coin") + (int)eItem[0].price); + Debug.Log("EffectDefaulter"); + AddEffects(0); + EquipUnEquipEffect(0); + } + } public bool IsProductPurchased(string productId) { @@ -547,7 +557,7 @@ public class ShopManager : MonoBehaviour, IDetailedStoreListener void AddEffects(int index) { int coins = PlayerPrefs.GetInt("Coin"); - if (coins > eItem[index].price) + if (coins >= eItem[index].price) { SubtractCoins((int)eItem[index].price); PlayerPrefs.SetInt("EffectButtonIsPurchased" + index, 1);