예제 #1
0
        /// <summary>
        /// Create a blend from one ICinemachineCamera to another,
        /// or to/from a point, if we can't do anything else
        /// </summary>
        private CinemachineBlend CreateBlend(
            ICinemachineCamera camA, ICinemachineCamera camB,
            AnimationCurve blendCurve, float duration,
            CinemachineBlend activeBlend)
        {
            //UnityEngine.Profiling.Profiler.BeginSample("CinemachineTrackedDolly.MutateCameraState");
            if (blendCurve == null || duration <= 0 || (camA == null && camB == null))
            {
                //UnityEngine.Profiling.Profiler.EndSample();
                return(null);
            }
            if (camA == null || activeBlend != null)
            {
                // Blend from the current camera position
                CameraState state = CameraState.Default;
                if (activeBlend != null)
                {
                    state = activeBlend.State;
                }
                else
                {
                    state.RawPosition    = transform.position;
                    state.RawOrientation = transform.rotation;
                    state.Lens           = LensSettings.FromCamera(OutputCamera);
                }
                camA = new StaticPointVirtualCamera(state, activeBlend == null ? "(none)" : "Mid-blend");
            }
            CinemachineBlend blend = new CinemachineBlend(camA, camB, blendCurve, duration, 0);

            //UnityEngine.Profiling.Profiler.EndSample();
            return(blend);
        }
예제 #2
0
        private CinemachineBlend CreateBlend(
            ICinemachineCamera camA, ICinemachineCamera camB,
            AnimationCurve blendCurve, float duration,
            CinemachineBlend activeBlend, float deltaTime)
        {
            if (blendCurve == null || duration <= 0 || (camA == null && camB == null))
            {
                return(null);
            }

            if (camA == null || activeBlend != null)
            {
                // Blend from the current camera position
                CameraState state = (activeBlend != null) ? activeBlend.State : State;
                camA = new StaticPointVirtualCamera(state, (activeBlend != null) ? "Mid-blend" : "(none)");
            }
            return(new CinemachineBlend(camA, camB, blendCurve, duration, 0));
        }