Default Effect

dev-ali
Ali Sharoz 1 week ago
parent 8ff453425a
commit 95394ceb58

@ -69,13 +69,23 @@ public class ShopManager : MonoBehaviour, IDetailedStoreListener
} }
private void Start() private void Start()
{ {
EffectDefaulter();
int coins = PlayerPrefs.GetInt("Coin"); int coins = PlayerPrefs.GetInt("Coin");
coinTxt.text = coins.ToString(); coinTxt.text = coins.ToString();
SetupBuilder(); SetupBuilder();
PipePrefGetter(); PipePrefGetter();
EffectPrefGetter(); 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) public bool IsProductPurchased(string productId)
{ {
@ -547,7 +557,7 @@ public class ShopManager : MonoBehaviour, IDetailedStoreListener
void AddEffects(int index) void AddEffects(int index)
{ {
int coins = PlayerPrefs.GetInt("Coin"); int coins = PlayerPrefs.GetInt("Coin");
if (coins > eItem[index].price) if (coins >= eItem[index].price)
{ {
SubtractCoins((int)eItem[index].price); SubtractCoins((int)eItem[index].price);
PlayerPrefs.SetInt("EffectButtonIsPurchased" + index, 1); PlayerPrefs.SetInt("EffectButtonIsPurchased" + index, 1);

Loading…
Cancel
Save