Esempio n. 1
0
    void OnTriggerEnter(Collider other)
    {
        Debug.Log("TileEntity Colliding with something");
        Player player = other.gameObject.GetComponent <Player>();

        if (player != null)
        {
            Debug.Log("Player is trying to pick up item");

            ItemSlot slot = player.GetFirstAvailableSlot(id);
            Debug.Log("slot: " + slot);
            if (slot != null)
            {
                ItemStack stack = new ItemStack(id, 1);
                slot.AddStack(stack);
                Destroy(gameObject);
            }
        }
    }