コード例 #1
0
        private void Awake()
        {
            ShakeableCameraDetector cameraDetectorScript = shakeableCameraDetector.GetComponent <ShakeableCameraDetector>();

            if (cameraDetectorScript != null)
            {
                cameraDetectorScript.OnCollideWithShakeableCamera.AddListener(OnCollideWithShakeableCamera);
            }
        }
コード例 #2
0
        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;
                }
            }
        }