void ForgetPointOfInterestIfInactiveOrOnDifferentLayer() { if (currentPointOfInterest == null) { return; } if (!currentPointOfInterest.gameObject.activeInHierarchy) { currentPointOfInterest = null; return; } var layer = currentPointOfInterest.gameObject.layer; if (world.CurrentSlice.layer != layer) { currentPointOfInterest = null; } }
void OnTriggerEnter2D(Collider2D other) { var point = other.gameObject.GetComponent<PointOfInterest>(); if (point == null) { return; } if (point.gameObject.layer != world.CurrentSlice.layer) { return; } currentPointOfInterest = point; SaveCameraLastAbsolutePosition(); }
void OnTriggerExit2D(Collider2D other) { var point = other.gameObject.GetComponent<PointOfInterest>(); if (point == null) { return; } if (point != currentPointOfInterest) { return; } currentPointOfInterest = null; }