コード例 #1
0
 //creats slots for this bag
 public void AddSlots(int slotCount)
 {
     for (int i = 0; i < slotCount; i++)
     {
         SlotScript slot = Instantiate(slotPrefab, transform).GetComponent <SlotScript>();
         slot.MyBag = this;
         MySlots.Add(slot);
     }
 }
コード例 #2
0
 /// <summary>
 /// Creates Slots for this bag
 /// </summary>
 /// <param name="slotCount">Amount of slots to create</param>
 public void AddSlots(int slotCount)
 {
     for (int i = 0; i < slotCount; i++)
     {
         // create a slot cannled slot and set reference to its script
         SlotScript slot = Instantiate(slotPrefab, transform).GetComponent <SlotScript>();
         // make sure the bag knows what bag it belongs to
         slot.MyBag = this;
         // add this slot to the list of slots
         MySlots.Add(slot);
     }
 }