Example #1
0
 public override void OnCLick()
 {
     if (ThisItem)
     {
         PlayerManager player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerManager>();
         Debug.Log(player.Coins);
         if (player.Coins - ThisItem.price >= 0)
         {
             player.Coins -= ThisItem.price;
             UpdateCoins.Raise();
             AddItem();
             UpdateInventory.Raise();
             ItemDescription.GetComponent <TextMeshProUGUI>().text = "";
             if (ThisItem.Unique)
             {
                 Destroy(this.gameObject);
                 for (int i = 0; i < Shop.MyInventory.Count; i++)
                 {
                     if (ThisItem.name == Shop.MyInventory[i].name)
                     {
                         Shop.MyInventory.Remove(Shop.MyInventory[i]);
                     }
                 }
             }
         }
     }
 }
Example #2
0
    public override void OnPointerEnter(PointerEventData eventdata)
    {
        if (!ItemDescription)
        {
            ItemDescription = GameObject.FindGameObjectWithTag("Description");
        }
        ItemDescription.GetComponent <TextMeshProUGUI>().text = ThisItem.ItemDescription;
        PlayerManager player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerManager>();

        if (player.Level < ThisItem.necessaryLevel)
        {
            ItemDescription.GetComponent <TextMeshProUGUI>().text += "\nThis item will be unlocked on the " + ThisItem.necessaryLevel + " level";
        }
    }