Example #1
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)
                {
                    _camera.IsButtonOff = true;
                }
            }

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

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

            noise             = _camera.Noise;
            _crossDPAI        = _camera.TargetCrossDPAI;
            _crossOLDD        = _camera.TargetCrossOLDD;
            _targetCrossStock = _camera.TargetCrossStock;

            if (_camera.IsAuxiliaryWindowButtonPres)
            {
                StartCoroutine(_camera.ResizeWindow());
            }
            if (_camera.IsActive)
            {
                _camera.Update();
            }
        }
        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)
                {
                    camera.IsButtonOff = true;
                }
            }

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

            if (IsEnabled)
            {
                Activate();
            }
            else
            {
                Deactivate();
            }
            noise      = camera.Noise;
            _crossDPAI = camera.TargetCrossDPAI;
            _crossOLDD = camera.TargetCrossOLDD;

            if (camera.IsAuxiliaryWindowButtonPres)
            {
                base.StartCoroutine(camera.ResizeWindow());
            }

            if (camera.IsActive)
            {
                camera.Update();
            }
        }