Exemple #1
0
    public bool dropItem(Item item)
    {
        if (inventory.Contains(item) && isItemDropable(item))
        {
            inventory.Remove(item);
            GameObject itemGO = Instantiate(item.prefab, this.transform.position + (this.transform.forward * 0.5f), Quaternion.identity);
            Rigidbody  itemRB = itemGO.transform.GetComponent <Rigidbody>();
            itemRB.AddForce((this.transform.forward * 0.5f), ForceMode.Impulse);
            UIEventHandler.ItemDroppedFromInventory(item);
            return(true);
        }

        return(false);
    }