Beispiel #1
0
 private void Buy()
 {
     if (CoinManager.Pay(_myItem.GetCosts()))
     {
         BuyButton.interactable = false;
         _myItem.Unlock();
         shopUi.SetCoinText(CoinManager.GetCoinTotal());
     }
     else
     {
         // Play sound or some shit.
     }
 }
Beispiel #2
0
    public void SetData(ShopItem item)
    {
        _myItem          = item;
        ItemTitle.text   = item.ItemName;
        Thumbnail.sprite = item.Thumbnail;
        BuyText.text     = item.GetCosts().ToString();

        if (_myItem.IsUnlocked())
        {
            BuyButton.interactable = false;
        }
        else
        {
            BuyButton.onClick.AddListener(Buy);
        }
    }