Example #1
0
    void updatePanelSlots()
    {
        int index = 0;

        foreach (Transform child in inventoryPanel.transform)
        {
            inventorySlotController slot = child.GetComponent <inventorySlotController>();

            if (index < list.Count)
            {
                slot.item = list[index];
            }
            else
            {
                slot.item = null;
            }
            slot.updateInfo();

            index++;
        }
    }
Example #2
0
    public void updatePanelSlots()
    {
        playerDataManager = GameObject.FindGameObjectWithTag("DataManager");

        var catList = playerDataManager.GetComponent <DataManager>().getCurCats();
        int index   = 0;

        foreach (Transform child in InventoryPanel.transform)
        {
            inventorySlotController slot = child.GetComponent <inventorySlotController>();
            if (index < catList.Count)
            {
                var assetPath = "Prefabs/Inventory/" + catList[index];
                slot.item = Resources.Load <Pokemon>(assetPath);
            }
            else
            {
                slot.item = (Pokemon)Resources.Load("Prefabs/Inventory/No Cat");;
            }
            slot.updateInfo();
            index++;
        }
    }