Ejemplo n.º 1
0
        public bool IsLive(ICinemachineCamera vcam)
        {
            if (this.IsLiveItself(vcam))
            {
                return(true);
            }
            ICinemachineCamera parentCamera = vcam.ParentCamera;

            while (parentCamera != null && parentCamera.IsLiveChild(vcam))
            {
                if (this.IsLiveItself(parentCamera))
                {
                    return(true);
                }
                vcam         = parentCamera;
                parentCamera = vcam.ParentCamera;
            }
            return(false);
        }
        /// <summary>
        /// Checks if the vcam is live as part of an outgoing blend.
        /// Does not check whether the vcam is also the current active vcam.
        /// </summary>
        /// <param name="vcam">The virtual camera to check</param>
        /// <returns>True if the virtual camera is part of a live outgoing blend, false otherwise</returns>
        public bool IsLiveInBlend(ICinemachineCamera vcam)
        {
            // Ignore mCurrentLiveCameras.CamB
            if (vcam == mCurrentLiveCameras.CamA)
            {
                return(true);
            }
            var b = mCurrentLiveCameras.CamA as BlendSourceVirtualCamera;

            if (b != null && b.Blend.Uses(vcam))
            {
                return(true);
            }
            ICinemachineCamera parent = vcam.ParentCamera;

            if (parent != null && parent.IsLiveChild(vcam, false))
            {
                return(IsLiveInBlend(parent));
            }
            return(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// True if the ICinemachineCamera the current active camera,
        /// or part of a current blend, either directly or indirectly because its parents are live.
        /// </summary>
        /// <param name="vcam">The camera to test whether it is live</param>
        /// <param name="dominantChildOnly">If truw, will only return true if this vcam is the dominat live child</param>
        /// <returns>True if the camera is live (directly or indirectly)
        /// or part of a blend in progress.</returns>
        public bool IsLive(ICinemachineCamera vcam, bool dominantChildOnly = false)
        {
            if (SoloCamera == vcam)
            {
                return(true);
            }
            if (mCurrentLiveCameras.Uses(vcam))
            {
                return(true);
            }

            ICinemachineCamera parent = vcam.ParentCamera;

            while (parent != null && parent.IsLiveChild(vcam, dominantChildOnly))
            {
                if (SoloCamera == parent || mCurrentLiveCameras.Uses(parent))
                {
                    return(true);
                }
                vcam   = parent;
                parent = vcam.ParentCamera;
            }
            return(false);
        }