コード例 #1
0
        /// <summary>
        /// Set active camera
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="type">The type.</param>
        /// <param name="timeOrStep">The time or step.</param>
        public void SetActiveCamera(String name, InterpolationType type, float timeOrStep)
        {
            if (activeCameraType == State.NORMAL)
            {
                activeCameraType = State.INTERPOLATING;
                int ind = _cameras.FindIndex(delegate(CameraDescription t) { return(t.name == name); });
                if (ind == -1)
                {
                    ActiveLogger.LogMessage("Camera Name Not found, maybe you did not added it to the camera manager", LogLevel.RecoverableError);
                    return;
                }
                CameraInterpolator ci = new CameraInterpolator(_activeCam, _cameras[ind].cam, type, timeOrStep);

                ci.OnInterpolationFinished += new CameraInterpolator.InterpolationFinished(ci_OnInterpolationFinished);
                ci.Name = INTERPOLATORCAMERA;
                CameraDescription cc = new CameraDescription();
                cc.cam  = ci;
                cc.name = INTERPOLATORCAMERA;
                _cameras.Add(cc);
                int added = _cameras.FindIndex(delegate(CameraDescription t) { return(t.name == INTERPOLATORCAMERA); });
                _activeCam = _cameras[added].cam;
            }
            else
            {
                CameraInterpolator ac = (_activeCam as CameraInterpolator);
                int ind = _cameras.FindIndex(delegate(CameraDescription t) { return(t.name == name); });
                if (ind == -1)
                {
                    ActiveLogger.LogMessage("Camera Name Not found, maybe you did not added it to the camera manager", LogLevel.RecoverableError);
                }
                ac.Reset(_activeCam, _cameras[ind].cam);
            }
        }
コード例 #2
0
        /// <summary>
        /// Set active camera
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="type">The type.</param>
        /// <param name="timeOrStep">The time or step.</param>
        public void SetActiveCamera(String name,  InterpolationType type ,float timeOrStep)
        {
            if (activeCameraType == State.NORMAL)
            {
                activeCameraType = State.INTERPOLATING;
                int ind = _cameras.FindIndex(delegate(CameraDescription t) { return t.name == name; });
                if (ind == -1)
                {
                    ActiveLogger.LogMessage("Camera Name Not found, maybe you did not added it to the camera manager", LogLevel.RecoverableError);
                    return;
                }
                CameraInterpolator ci = new CameraInterpolator(_activeCam, _cameras[ind].cam, type, timeOrStep);               

                ci.OnInterpolationFinished += new CameraInterpolator.InterpolationFinished(ci_OnInterpolationFinished);
                ci.Name = INTERPOLATORCAMERA;
                CameraDescription cc = new CameraDescription();
                cc.cam = ci;
                cc.name = INTERPOLATORCAMERA;
                _cameras.Add(cc);
                int added = _cameras.FindIndex(delegate(CameraDescription t) { return t.name == INTERPOLATORCAMERA; });
                _activeCam = _cameras[added].cam;
            }
            else
            {
                CameraInterpolator ac = (_activeCam as CameraInterpolator);                
                int ind = _cameras.FindIndex(delegate(CameraDescription t) { return t.name == name; });
                if (ind == -1)
                {
                    ActiveLogger.LogMessage("Camera Name Not found, maybe you did not added it to the camera manager", LogLevel.RecoverableError);
                }
                ac.Reset(_activeCam, _cameras[ind].cam);                
            }
        }