public void BuyProduct() { bool bought = false; string currency = ""; if (product.realMoney) { //pass the product ID to the in app purchase manager return; } else if (product.pCheese) { bought = grm.EarnOrSpendCheese(-(int)product.payAmount); currency = "cheese"; } else { bought = grm.EarnOrSpendCoin(-(int)product.payAmount); currency = "coins"; } if (bought) { ReceiveProduct(); } else { messagePanel.NotEnoughMoney(currency); } }
public void BuyItem() { bool bought = false; string currency; if (accessory.isCoin) { bought = grm.EarnOrSpendCoin(-accessory.price); currency = "coins"; } else { bought = grm.EarnOrSpendCheese(-accessory.price); currency = "cheese"; } if (bought == true) { BuyItemSuccessful(); } else { messagePanel.NotEnoughMoney(currency); } }