Esempio n. 1
0
    private void checkTypePresence(RandomItemGenerator itemGenerator)
    {
        //ArrayList container
        int counter = 0;
        int index   = 0;

        foreach (RandomItemGenerator item in itemsFittedList)
        {
            if (item.getItemType() == itemGenerator.getItemType())
            {
                counter++;
                break;
            }
            index++;
        }
        if (counter > 0)
        {
            itemsFittedList.RemoveAt(index);
        }
    }
    void swapItem()
    {
        //Debug.Log(transform.GetSiblingIndex());
        //RandomItemGenerator rid = transform.GetComponentInParent<InventoryController>().getObject(transform.GetSiblingIndex());
        switch (randomItem.getItemType())
        {
        case 0:
            transform.GetComponentInParent <InventoryController>().sendToInventorySlot(transform.GetSiblingIndex(), "_helmetTag", "_inventoryList");
            break;

        case 1:
            transform.GetComponentInParent <InventoryController>().sendToInventorySlot(transform.GetSiblingIndex(), "_armorTag", "_inventoryList");
            break;

        case 2:
            transform.GetComponentInParent <InventoryController>().sendToInventorySlot(transform.GetSiblingIndex(), "_weapon1Tag", "_inventoryList");
            break;

        case 3:
            transform.GetComponentInParent <InventoryController>().sendToInventorySlot(transform.GetSiblingIndex(), "_weapon2Tag", "_inventoryList");
            break;

        case 4:
            transform.GetComponentInParent <InventoryController>().sendToInventorySlot(transform.GetSiblingIndex(), "_mod1Tag", "_inventoryList");
            break;

        case 5:
            transform.GetComponentInParent <InventoryController>().sendToInventorySlot(transform.GetSiblingIndex(), "_mod2Tag", "_inventoryList");
            break;

        case 6:
            transform.GetComponentInParent <InventoryController>().sendToInventorySlot(transform.GetSiblingIndex(), "_mod3Tag", "_inventoryList");
            break;

        default:
            break;
        }
    }