Example #1
0
        // PRIVATE

        public void SpawnPickup(InventoryItem item, Vector3 spawnLocation, int number)
        {
            var pickup = item.SpawnPickup(spawnLocation, number);

            droppedItems.Add(pickup);
        }
Example #2
0
        // PUBLIC

        /// <summary>
        /// Set the vital data after creating the prefab.
        /// </summary>
        /// <param name="item">The type of item this prefab represents.</param>
        public void Setup(InventoryItem item)
        {
            this.item = item;
        }
Example #3
0
 /// <summary>
 /// Create a pickup at the current position.
 /// </summary>
 /// <param name="item">The item type for the pickup.</param>
 public void DropItem(InventoryItem item)
 {
     SpawnPickup(item, GetDropLocation(), 1);
 }
Example #4
0
        // PUBLIC

        /// <summary>
        /// Create a pickup at the current position.
        /// </summary>
        /// <param name="item">The item type for the pickup.</param>
        /// <param name="number">
        /// The number of items contained in the pickup. Only used if the item
        /// is stackable.
        /// </param>
        public void DropItem(InventoryItem item, int number)
        {
            SpawnPickup(item, GetDropLocation(), number);
        }
Example #5
0
 /// <summary>
 /// Could this item fit anywhere in the inventory?
 /// </summary>
 public bool HasSpaceFor(InventoryItem item)
 {
     return(FindSlot(item) >= 0);
 }
Example #6
0
 /// <summary>
 /// Find a slot that can accomodate the given item.
 /// </summary>
 /// <returns>-1 if no slot is found.</returns>
 private int FindSlot(InventoryItem item)
 {
     return(FindEmptySlot());
 }
Example #7
0
 /// <summary>
 /// Could this item fit anywhere in the inventory?
 /// </summary>
 public bool HasSpaceFor(InventoryItem item)
 {
     return(FindSlot(item) >= 0); //item의 slot number(index)가 정상적 할당 되었으면 값 return
 }