// PRIVATE public void SpawnPickup(InventoryItem item, Vector3 spawnLocation, int number) { var pickup = item.SpawnPickup(spawnLocation, number); droppedItems.Add(pickup); }
// 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; }
/// <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); }
// 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); }
/// <summary> /// Could this item fit anywhere in the inventory? /// </summary> public bool HasSpaceFor(InventoryItem item) { return(FindSlot(item) >= 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()); }
/// <summary> /// Could this item fit anywhere in the inventory? /// </summary> public bool HasSpaceFor(InventoryItem item) { return(FindSlot(item) >= 0); //item의 slot number(index)가 정상적 할당 되었으면 값 return }