public int getQuant(Item_Categories iCat, int subType) { string comp = iCat + "|" + subType; if (!itemNum.ContainsKey(comp)) { itemNum.Add(comp, 0); } return(itemNum[comp]); }
public void ChangeQuant(Item_Categories iCat, int subType, int change) { string comp = iCat + "|" + subType; if (!itemNum.ContainsKey(comp)) { itemNum.Add(comp, 0); } itemNum[comp] += change; }
public Slot remove(Item_Categories e, int itype) { for (int i = 0; i < capacity; i++) { if (inventory[i].cat == e && inventory[i].itm == itype) { inventory[i] = new Slot(); ChangeQuant(e, itype, -1); return(null); } } return(null); }
public void add(Item_Categories category, int item, int quantity) { for (int i = 0; i < capacity && quantity > 0; i++) { if (inventory[i].quant == 0) { Slot s = new Slot(category, item, 1); inventory[i] = s; ChangeQuant(category, item, 1); occupiedSlots++; quantity--; } } if (occupiedSlots == capacity) { Debug.Log("Maxed Capacity"); } }
public Slot() { cat = Item_Categories.Nothing; itm = 0; quant = 0; }
public Slot(Item_Categories category, int item, int quantity) { cat = category; itm = item; quant = quantity; }