//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; } }
public void Buy() { if (InventoryControll.instance.money >= selectedShop.item.ItemPrice()) { InventoryControll.instance.AddItem(selectedShop.item); InventoryControll.instance.money -= selectedShop.item.ItemPrice(); SetOffOptButtons(); selectedShop = null; } }
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); } }
//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); }
private void OnDisable() { selectedShop = null; }
private void OnEnable() { selectedShop = null; }