void OnTriggerStay2D(Collider2D col) { if (!trigger || collisionTag == "") { return; } if (col.tag == collisionTag) { OnStay.Invoke(gameObject, col.gameObject); } }
void OnTriggerExit(Collider col) { if (!trigger || collisionTag == "") { return; } if (col.tag == collisionTag) { OnExit.Invoke(gameObject, col.gameObject); } }
void OnTriggerStay(Collider col) { if (!trigger || collisionTag == "") { return; } if (col.tag == collisionTag && (!alsoCheckName || (alsoCheckName && col.gameObject.name == optionalName)) ) { //Debug.Log(gameObject.name + " OnTriggerStay with " + col.gameObject.name); OnStay.Invoke(gameObject, col.gameObject); } }
// ------------------------------------------------------------------------- private void OnCollisionExit2D(Collision2D collision) { // If after all our checks, this was a valid collision... if (IsCollisionValid(collision) == true) { // Inform our listening actions that the collision ended onCollisionExitActions.Invoke(collision.collider.gameObject); } }