private void OnPulledIn() { Item item = GetComponent <Item>(); if (item != null) { if (comptoir.OnItemEnter(item)) { } else { Destroy(gameObject); } } }
//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(); } } } }