private void Awake() { ShakeableCameraDetector cameraDetectorScript = shakeableCameraDetector.GetComponent <ShakeableCameraDetector>(); if (cameraDetectorScript != null) { cameraDetectorScript.OnCollideWithShakeableCamera.AddListener(OnCollideWithShakeableCamera); } }
private void Reset() { if (body == null) { body = GetComponent <Rigidbody>(); } if (shakeableCameraDetector == null) { ShakeableCameraDetector detectorScript = GetComponentInChildren <ShakeableCameraDetector>(); if (detectorScript == null) { shakeableCameraDetector = new GameObject("ShakeableCameraDetector"); shakeableCameraDetector.transform.parent = transform; shakeableCameraDetector.transform.localPosition = Vector3.zero; shakeableCameraDetector.AddComponent <ShakeableCameraDetector>(); } else { shakeableCameraDetector = detectorScript.gameObject; } } }