예제 #1
0
        private static void ToMainCamera()
        {
            if (_cam != null)
            {
                _cam.transform.parent        = _origParent;
                _cam.transform.localPosition = _origPosition;
                _cam.transform.localRotation = _origRotation;
                _cam.SetFoV(_origFoV);
                _cam.ActivateUpdate();

                if (FlightGlobals.ActiveVessel != null && HighLogic.LoadedSceneIsFlight)
                {
                    _cam.SetTarget(FlightGlobals.ActiveVessel.transform, FlightCamera.TargetMode.Vessel);
                }

                _origParent = null;
            }

            if (_currentCamera != null)
            {
                _currentCamera.ltCamActive = false;
            }

            _currentCamera            = null;
            Camera.main.nearClipPlane = _origClip;
        }
예제 #2
0
 private void OnGameSceneLoadRequested(GameScenes gameScene)
 {
     if (_currentCamera != null)
     {
         _cameras.Clear();
         _currentCamera = null;
     }
 }
예제 #3
0
        private void CleanUp()
        {
            if (_currentCamera == this)
            {
                LeaveCamera();
            }

            if (ltCamActive)
            {
                _currentCamera = null;
                ToMainCamera();
            }
        }
예제 #4
0
        public void LateUpdate()
        {
            if (vessel == null)
            {
                return;
            }

            if (_currentHandler == null)
            {
                _currentHandler = this;
            }

            if (_currentCamera != null)
            {
                if (_currentCamera.vessel != FlightGlobals.ActiveVessel)
                {
                    Vector3d vesselPos = FlightGlobals.ActiveVessel.orbit.getRelativePositionAtUT(Planetarium.GetUniversalTime()) + FlightGlobals.ActiveVessel.orbit.referenceBody.position;
                    Vector3d targetPos = _currentCamera.vessel.orbit.getRelativePositionAtUT(Planetarium.GetUniversalTime()) + _currentCamera.vessel.orbit.referenceBody.position;

                    _cameraDistance = Vector3d.Distance(vesselPos, targetPos);

                    if (_cameraDistance >= 2480.0)
                    {
                        LeaveCamera();
                    }
                }
            }

            if (!_takingPic && _tookPic && Settings.hideUiOnScreenshot)
            {
                GameEvents.onShowUI.Fire();
            }

            if (_takingPic)
            {
                _timer += Time.deltaTime;

                if (_timer > 0.1f && !_tookPic)
                {
                    TakeScreenshot();
                }

                if (_timer > Settings.shuttertime)
                {
                    ToMainCamera();
                    DoExperiment();
                    _takingPic = false;
                }
            }
        }
예제 #5
0
        private void ActivateCamera()
        {
            if (part.State == PartStates.DEAD)
            {
                return;
            }

            if (ltCamActive)
            {
                ToMainCamera();
                return;
            }

            _currentCamera = this;
            ltCamActive    = true;
        }
예제 #6
0
        private void CleanUp()
        {
            if (_currentHandler == this)
            {
                _currentHandler = null;
            }

            if (_currentCamera == this)
            {
                LeaveCamera();
            }

            if (_cameras.Contains(this))
            {
                _cameras.Remove(this);

                if (_cameras.Count < 1 && _origParent != null && !ltCamActive)
                {
                    _currentCamera = null;
                    ToMainCamera();
                }
            }
        }
예제 #7
0
        private void ActivateCamera()
        {
            if (part.State == PartStates.DEAD)
            {
                return;
            }

            ltCamActive = !ltCamActive;

            if (!ltCamActive && (_cam != null))
            {
                ToMainCamera();
            }
            else
            {
                if ((_currentCamera != null) && (_currentCamera != this))
                {
                    _currentCamera.ltCamActive = false;
                }

                _currentCamera = this;
                BeginPic();
            }
        }