Beispiel #1
0
        public override void OnUpdate()
        {
            if (camera == null)
            {
                return;
            }
            if (DockCamToolbarButton.FCS && base.part.vessel != FlightGlobals.ActiveVessel && IsEnabled)
            {
                float num  = Vector3.Distance(FlightGlobals.ActiveVessel.transform.position, base.part.vessel.transform.position);
                float load = base.vessel.vesselRanges.orbit.load;
                if ((double)num > (double)load * 0.99)
                {
                    ScreenMessages.PostScreenMessage("FORCED SHUTDOWN", 3f, 0);
                    camera.IsButtonOff = true;
                }
            }
            if (_isPowered == "FALSE")
            {
                if (IsEnabled)
                {
                    ScreenMessages.PostScreenMessage("ELECTRICITY HAS BEEN DEPLETED", 3f, 0);
                }
                camera.IsButtonOff = true;
            }
            if (camera.IsButtonOff)
            {
                IsEnabled          = false;
                camera.IsButtonOff = false;
            }
            if (camera.IsToZero)
            {
                camera.IsToZero = false;
                base.StartCoroutine(camera.ReturnCamToZero());
            }
            if (camera.IsWaitForRay)
            {
                camera.IsWaitForRay = false;
                base.StartCoroutine(camera.WaitForRay());
            }
            isOnboard          = camera.IsOnboard;
            isLookAtMe         = camera.IsLookAtMe;
            isLookAtMeAutoZoom = camera.IsLookAtMeAutoZoom;
            isFollowMe         = camera.IsFollowMe;
            isTargetCam        = camera.IsTargetCam;

            if (isFollowMe)
            {
                _isFollowMeOffsetX = camera.IsFollowMeOffsetX;
                _isFollowMeOffsetY = camera.IsFollowMeOffsetY;
                _isFollowMeOffsetZ = camera.IsFollowMeOffsetZ;
            }
            if (isTargetCam)
            {
                _targetOffset = camera.TargetOffset;
            }
            if (isOnboard)
            {
                Onboard();
            }
            if (isLookAtMe)
            {
                LookAtMe();
            }
            if (isFollowMe)
            {
                FollowMe();
            }
            if (isTargetCam)
            {
                TargetCam();
            }
            _currentHits = camera.Hits;
            aboutHits    = _currentHits + "/4";

            if (IsEnabled)
            {
                Activate();
            }
            else
            {
                Deactivate();
            }
            if (camera.IsAuxiliaryWindowButtonPres)
            {
                base.StartCoroutine(camera.ResizeWindow());
            }
            if (camera.IsActive)
            {
                camera.Update();
            }
        }
Beispiel #2
0
        public override void OnUpdate()
        {
            if (_camera == null)
            {
                return;
            }

            if (HighLogic.CurrentGame.Parameters.CustomParams <KURSSettings>().FCS&& part.vessel != FlightGlobals.ActiveVessel && IsEnabled)
            {
                var dist      = Vector3.Distance(FlightGlobals.ActiveVessel.transform.position, part.vessel.transform.position);
                var treshhold = vessel.vesselRanges.orbit.load;
                if (dist > treshhold * 0.99)
                {
                    ScreenMessages.PostScreenMessage("FORCED SHUTDOWN", 3f, ScreenMessageStyle.UPPER_CENTER);
                    _camera.IsButtonOff = true;
                }
            }

            if (_isPowered == "FALSE")
            {
                if (IsEnabled)
                {
                    ScreenMessages.PostScreenMessage("ELECTRICITY HAS BEEN DEPLETED", 3f, ScreenMessageStyle.UPPER_CENTER);
                }
                _camera.IsButtonOff = true;
            }

            if (_camera.IsButtonOff)
            {
                IsEnabled           = false;
                _camera.IsButtonOff = false;
            }

            if (_camera.IsToZero)
            {
                _camera.IsToZero = false;
                StartCoroutine(_camera.ReturnCamToZero());
            }

            if (_camera.IsWaitForRay)
            {
                _camera.IsWaitForRay = false;
                StartCoroutine(_camera.WaitForRay());
            }

            _isOnboard          = _camera.IsOnboard;
            _isLookAtMe         = _camera.IsLookAtMe;
            _isLookAtMeAutoZoom = _camera.IsLookAtMeAutoZoom;
            _isFollowMe         = _camera.IsFollowMe;
            _isTargetCam        = _camera.IsTargetCam;

            if (_isFollowMe)
            {
                _isFollowMeOffsetX = _camera.IsFollowMeOffsetX;
                _isFollowMeOffsetY = _camera.IsFollowMeOffsetY;
                _isFollowMeOffsetZ = _camera.IsFollowMeOffsetZ;
            }

            if (_isTargetCam)
            {
                _targetOffset = _camera.TargetOffset;
            }

            if (_isOnboard)
            {
                Onboard();
            }
            if (_isLookAtMe)
            {
                LookAtMe();
            }
            if (_isFollowMe)
            {
                FollowMe();
            }
            if (_isTargetCam)
            {
                TargetCam();
            }

            _currentHits = _camera.Hits;
            _aboutHits   = _currentHits + "/4";

            if (IsEnabled)
            {
                Activate();
            }
            else
            {
                Deactivate();
            }

            if (_camera.IsAuxiliaryWindowButtonPres)
            {
                StartCoroutine(_camera.ResizeWindow());
            }
            if (_camera.IsActive)
            {
                _camera.Update();
            }
        }