public void BuyArrows(int index) { if (!GameController.instance.weapons[index]) { ConfirmationPanel.SetActive(true); yesBtn.onClick.RemoveAllListeners(); if (GameController.instance.coins >= 7000) { string arrow = ""; switch (index) { case 1: arrow = "double arrows"; break; case 2: arrow = "sticky arrows"; break; case 3: arrow = "double sticky arrows"; break; } ConfirmationText.text = "Do you want to purchase " + arrow + "?"; yesBtn.onClick.AddListener(() => ConfirmBuyArrows(index)); } else { ConfirmationText.text = "You do not have enough coins. Do you want to buy coins?"; yesBtn.onClick.AddListener(() => OpenCoinShop()); yesBtn.onClick.AddListener(() => CancelBuy()); } } }
public void ConfirmBuyArrows(int index) { GameController.instance.weapons [index] = true; GameController.instance.coins -= 7000; GameController.instance.Save(); ConfirmationPanel.SetActive(false); coinText.text = GameController.instance.coins.ToString(); }
public void CancelBuy() { ConfirmationPanel.SetActive(false); }