Example #1
0
    //adiciona um item ao slot
    public void AddItem(PickupItens item)
    {
        SlotShop empty = NextEmptySlot();//proximo slot vazio

        if (empty != null)
        {//o adiciona no proximo slot vaziu
            empty.item = item;
        }
    }
Example #2
0
 public void Buy()
 {
     if (InventoryControll.instance.money >= selectedShop.item.ItemPrice())
     {
         InventoryControll.instance.AddItem(selectedShop.item);
         InventoryControll.instance.money -= selectedShop.item.ItemPrice();
         SetOffOptButtons();
         selectedShop = null;
     }
 }
Example #3
0
    private void AddSlotShop(List <Construct> constructs, Transform content)
    {
        for (int i = 0; i < constructs.Count; i++)
        {
            Construct construct     = constructs[i];
            SlotShop  slotShop_temp = Instantiate(slotShop, content).GetComponent <SlotShop>();

            slotShop_temp.Set(construct);
        }
    }
Example #4
0
    //procura o primeiro slot vazio da lista
    private SlotShop NextEmptySlot()
    {
        SlotShop slotReturn = null;

        //checa cada slot do inventario
        foreach (SlotShop slot in invSlot)
        {
            //e caso nao tenha item
            if (slot.item == null)
            {
                //a variavel de retorno recebe o slot
                slotReturn = slot;
                break;
            }
        }
        return(slotReturn);
    }
Example #5
0
 private void OnDisable()
 {
     selectedShop = null;
 }
Example #6
0
 private void OnEnable()
 {
     selectedShop = null;
 }