예제 #1
0
파일: Hook.cs 프로젝트: EluardJ/ggj2021
    //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();
                }
            }
        }
    }