using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class InvenUI_Parent : MonoBehaviour
{
    public InvenParent inven;

    public List<InvenUI_Slot> uiSlotList = new List<InvenUI_Slot>();


    public void uiUpdate()
    {
        if (inven != null)
        {
            for (int i = 0; i < inven.slotList.Count; i++)
            {
                if (uiSlotList.Count <= i)
                {
                    uiSlotList.Add(Instantiate(InventoryManager.Instance.uiSlotPrefab, this.transform));
                }
                uiSlotList[i].setSlot(inven.slotList[i]);
                uiSlotList[i].gameObject.SetActive(true);
            }
            for (int i = inven.slotList.Count; i < uiSlotList.Count; i++)
            {
                uiSlotList[i].setSlot(null);
                uiSlotList[i].gameObject.SetActive(false);
            }
        }

    }
}
