Exemplo n.º 1
0
    //private void OnCollisionEnter(Collision collision)
    //{
    //    if (isActive && !isHoldingSomething && collision.gameObject.CompareTag("Movable"))
    //        Grab(collision.transform);
    //}

    private void OnTriggerEnter(Collider other)
    {
        if (grabbedObject == null)
        {
            return;
        }
        ComptoirChunk comptoirChunk = other.GetComponent <ComptoirChunk>();
        Item          grabbedItem   = grabbedObject.GetComponent <Item>();

        if (comptoirChunk != null && grabbedItem != null)
        {
            bool hasBeenDropped = comptoirChunk.OnItemEnter(grabbedItem);
            if (hasBeenDropped)
            {
                DropItem();

                if (grapple != null)
                {
                    grapple.Drop();
                }
            }
        }
    }