void OnTriggerExit2D(Collider2D col) { ProximitySwitch ps = col.gameObject.GetComponent <ProximitySwitch>(); if (ps != null) { ps.setSwitchState(false, false); } }
void OnTriggerStay2D(Collider2D col) { ProximitySwitch ps = col.gameObject.GetComponent <ProximitySwitch>(); if (ps != null) { ps.setSwitchState(true, GeometryUtility.TestPlanesAABB(GeometryUtility.CalculateFrustumPlanes(Camera.main), col.bounds)); } }