コード例 #1
0
        public void InstantiateNewSlots(int amount)
        {
            for (int i = 0; i < amount; i++)
            {
                GameObject templateClone = Instantiate(inventoryUISlotTemplate.gameObject, Vector3.zero, Quaternion.identity);
                templateClone.name = "Slot" + i;
                InventoryUISlot slot = templateClone.GetComponent <InventoryUISlot>();
                slot.SetInventoryUIObject(null);
                slot.GetTransform().SetParent(inventoryUISlotTemplate.GetTransform().parent);
                slot.GetTransform().localScale = inventoryUISlotTemplate.GetTransform().localScale;
                slot.gameObject.SetActive(true);
                slot.Init(this);

                slots.Add(slot);
            }
        }
コード例 #2
0
 public void SetCurrentSlot(InventoryUISlot slot)
 {
     currentSlot = slot;
     currentSlot.SetInventoryUIObject(this);
     GetTransform().SetParent(slot.GetTransform());
     GetTransform().localPosition = Vector3.zero;
 }