예제 #1
0
    public int getQuant(Item_Categories iCat, int subType)
    {
        string comp = iCat + "|" + subType;

        if (!itemNum.ContainsKey(comp))
        {
            itemNum.Add(comp, 0);
        }
        return(itemNum[comp]);
    }
예제 #2
0
    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;
    }
예제 #3
0
    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);
    }
예제 #4
0
    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");
        }
    }
예제 #5
0
 public Slot()
 {
     cat   = Item_Categories.Nothing;
     itm   = 0;
     quant = 0;
 }
예제 #6
0
 public Slot(Item_Categories category, int item, int quantity)
 {
     cat   = category;
     itm   = item;
     quant = quantity;
 }