Exemplo n.º 1
0
    public void DropItem(int itemSlot)
    {
        Item itemToDrop = itemArray[itemSlot];

        if (itemToDrop != null)
        {
            Vector3 pointToDrop = player.RaycastView();
            if (pointToDrop == Vector3.zero)
            {
                pointToDrop = player.playerCam.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0.0f)) + (player.playerCam.transform.forward * player.interactDistance);
            }
            itemNameArray[itemSlot].text = "";
            itemToDrop.gameObject.SetActive(true);
            itemToDrop.transform.position = pointToDrop;
            itemArray[itemSlot]           = null;
        }
    }