public bool MakeCurrencyPurchase(LeveledStoreItem item) { int currency = PlayerPrefs.GetInt(CURRENCY_ID); LeveledStoreItem.Level nextLevel = item.GetNextLevel(); if (nextLevel == null) { return(false); } int cost = nextLevel.cost; if (currency >= cost) { PlayerPrefs.SetInt(CURRENCY_ID, currency - cost); item.PurchaseNextLevel(); return(true); } return(false); }
// Start is called before the first frame update void Start() { item = MyIAPManager.instance.LEVELED_ITEMS[LEVELED_ITEM_ID]; LABEL_FORMAT_STRING = LABEL_FORMAT_STRING.Replace("\\n", "\n"); COST_FORMAT_STRING = COST_FORMAT_STRING.Replace("\\n", "\n"); }