コード例 #1
0
ファイル: Movable.cs プロジェクト: EluardJ/ggj2021
    private void OnPulledIn()
    {
        Item item = GetComponent <Item>();

        if (item != null)
        {
            if (comptoir.OnItemEnter(item))
            {
            }
            else
            {
                Destroy(gameObject);
            }
        }
    }
コード例 #2
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();
                }
            }
        }
    }