private void OnTriggerExit(Collider other) { MagneticBody componentInParent = other.gameObject.GetComponentInParent <MagneticBody>(); if (!(componentInParent != null)) { return; } MagneticPoint[] array = componentInParent.magneticPoints; if (array == null) { return; } MagneticPoint[] array2 = array; foreach (MagneticPoint magneticPoint in array2) { if (showDebug) { Debug.Log(base.name + " Magnet Gone "); } if (magneticPoint.isActiveAndEnabled) { nearbyMagnetics.Remove(magneticPoint); } } }
private void OnCollisionExit(Collision collision) { if (collision.collider.attachedRigidbody == null) { return; } MagneticBody componentInChildren = collision.collider.attachedRigidbody.gameObject.GetComponentInChildren <MagneticBody>(); if (!(componentInChildren == null)) { if (showDebug) { Debug.Log(base.name + " Removing Magnet "); } contactMagnetBodies.Remove(componentInChildren.Body); } }