Exemple #1
0
    public void PlusNumber(int num = 1)
    {
        this.num += num;
        InventoryItem item = GetComponentInChildren <InventoryItem>();

        if (item != null)
        {
            item.ChangeText(this.num);
        }
    }
Exemple #2
0
    public void SetId(int id, int num = 1)
    {
        this.id = id;
        info    = ObjectsInfo.instance.GetObjectInfoById(id);
        InventoryItem item = GetComponentInChildren <InventoryItem>();

        //Debug.Log(info);
        item.SetIconName(info.id, info.icon_name);

        this.num = num;

        item.ChangeText(this.num);
    }
Exemple #3
0
 public bool MinusNumber(int num = 1)
 {
     if (this.num >= num)
     {
         this.num -= num;
         InventoryItem item = GetComponentInChildren <InventoryItem>();
         if (this.num == 0)
         {
             ClearInfo();
             item.DestroyItem();
         }
         item.ChangeText(this.num);
         return(true);
     }
     return(false);
 }