private void AddSlot(Item item, int amt = 0){
for(int i = 0; i < allSlots; i++){
if(slot[i].GetComponent().empty){
slot[i].GetComponent().itemName = item.GetName();
if(amt == 0){
slot[i].GetComponent().itemAmount = item.GetBaseAmount();
}else{
slot[i].GetComponent().itemAmount = amt;
}
slot[i].GetComponent().iconType = item.GetSprite();
slot[i].GetComponent().fullItem = item;
slot[i].GetComponent().empty = false;
slot[i].GetComponent().UpdateSlot();
slot[i].transform.SetSiblingIndex(i);
break;
}
}
}
Leave a Reply