//Method to enable a given item in the player's inventory
    public void AddItem(int index)
    {
        //Toggle the "collected" state to true on the given item
        _helditemsScript.ToggleCollectedStatus(index, true);

        _helditemsScript.AttachToPlayer(index);
    }
Ejemplo n.º 2
0
    private void OnMouseOver()
    {
        takeText.GetComponent <Text>().enabled = true;

        //If the player left-clicks the item, hide the item in the world
        //and enable it in the player's inventory, visually and mechanically
        if (Input.GetMouseButtonDown(0))
        {
            heldItemScript.ToggleCollectedStatus(itemIndexNumber, true);
            HideObject();
        }
    }