/// <summary> /// Disables the current running camera script and return it. /// </summary> RuntimeCameraControl DisableCurrentCameraScript() { RuntimeCameraControl _previousCameraScript = null; foreach (RuntimeCameraControl cameraScript in transform.GetComponents <RuntimeCameraControl>()) { if (cameraScript != this && cameraScript.enabled == true) { _previousCameraScript = cameraScript; cameraScript.enabled = false; } } return(_previousCameraScript); }
/// <summary> /// Starts the slow motion_camera, and camera will keep dynamically focusing /// the transform. /// If timelength is not null, the timelength will override the defined timeLength value in /// Inspector. /// </summary> /// <param name='timelength'> /// Timelength. /// </param> void StartSlowMotion_MovableTransform(float?OverridedTimelength) { if (OverridedTimelength.HasValue) { SlowMotionTimeLength_Overrided = OverridedTimelength.Value; } else { //Use the default defined SlowMotion Duration: SlowMotionTimeLength_Overrided = this.SlowMotionDuration; } SlowMotionStartTime = Time.time; ApplyCameraControlParameter(false, CurrentTopDownCameraParameter); Time.timeScale = SlowMotionTimeScale; enabled = true; //preserves the previous active runtime camera script RuntimeCameraControl previousWorkingCameraScript = DisableCurrentCameraScript(); if (previousWorkingCameraScript != null) { this.previousCameraScript = previousWorkingCameraScript; } }