Example #1
0
        void Update()
        {
            if ((vessel != FlightGlobals.ActiveVessel) || vessel.isEVA)
            {
                if (mouseAimActive)
                {
                    ToggleMouseAim();
                }
                return;
            }

            if (PauseMenu.isOpen)
            {
                if (mouseAimActive)
                {
                    ToggleMouseAim();
                }
                //forceCursorResetNextFrame = true;
                return;
            }

            bool enableHotkeys = GUIUtility.keyboardControl == 0 && !MapView.MapIsEnabled && !InputLockManager.IsAllLocked(ControlTypes.KEYBOARDINPUT);

            if (vessel == FlightGlobals.ActiveVessel && vessel != prevActiveVessel)
            {
                prevActiveVessel = vessel;
                if (mouseAimActive)
                {
                    Cursor.lockState = CursorLockMode.Locked;
                    Cursor.visible   = false;
                }
                else
                {
                    Cursor.lockState = CursorLockMode.None;
                    Cursor.visible   = true;
                }
            }
            else if (enableHotkeys && Input.GetKeyDown(MouseAimSettings.ToggleKeyCode))
            {
                ToggleMouseAim();
            }

            if (enableHotkeys && Input.GetKeyDown(MouseAimSettings.FlightModeKeyCode))
            {
                flightMode.NextBehavior();
                ScreenMessages.PostScreenMessage("Flight Mode: " + flightMode.GetBehaviorName());
            }

            if (!mouseAimActive)
            {
                return;
            }

            UpdateMouseCursorForCameraRotation();
            UpdateVesselScreenLocation();
            UpdateCursorScreenLocation();
        }
Example #2
0
        void Update()
        {
            if (PauseMenu.isOpen)
            {
                mouseAimActive = false;
                //forceCursorResetNextFrame = true;
                return;
            }

            if (vessel == FlightGlobals.ActiveVessel && vessel != prevActiveVessel)
            {
                prevActiveVessel = vessel;
                if (mouseAimActive)
                {
                    Cursor.lockState = CursorLockMode.Locked;
                    Cursor.visible   = false;
                }
                else
                {
                    Cursor.lockState = CursorLockMode.None;
                    Cursor.visible   = true;
                }
            }
            else if (Input.GetKeyDown(MouseAimSettings.ToggleKeyCode))
            {
                mouseAimActive = !mouseAimActive;
                if (mouseAimActive)
                {
                    Cursor.lockState = CursorLockMode.Locked;
                    Cursor.visible   = false;
                }
                else
                {
                    Cursor.lockState = CursorLockMode.None;
                    Cursor.visible   = true;
                }
                targetPosition = vesselTransform.up * 5000f;     //if it's activated, set it to the baseline
                UpdateCursorScreenLocation();
            }

            if (vessel != FlightGlobals.ActiveVessel || !mouseAimActive)
            {
                return;
            }

            if (Input.GetKeyDown(MouseAimSettings.FlightModeKeyCode))
            {
                flightMode.NextBehavior();
                ScreenMessages.PostScreenMessage("Flight Mode: " + flightMode.GetBehaviorName());
            }

            UpdateMouseCursorForCameraRotation();
            UpdateVesselScreenLocation();
            UpdateCursorScreenLocation();
        }
Example #3
0
        void Update()
        {
            if ((vessel != FlightGlobals.ActiveVessel) || vessel.isEVA)
            {
                if (mouseAimActive)
                {
                    ToggleMouseAim();
                }
                return;
            }

            if (PauseMenu.isOpen)
            {
                if (mouseAimActive)
                {
                    ToggleMouseAim();
                }
                //forceCursorResetNextFrame = true;
                return;
            }

            if (vessel == FlightGlobals.ActiveVessel && vessel != prevActiveVessel)
            {
                prevActiveVessel = vessel;
                if (mouseAimActive)
                {
                    Cursor.lockState = CursorLockMode.Locked;
                    Cursor.visible   = false;
                }
                else
                {
                    Cursor.lockState = CursorLockMode.None;
                    Cursor.visible   = true;
                }
            }
            else if (Input.GetKeyDown(MouseAimSettings.ToggleKeyCode))
            {
                ToggleMouseAim();
            }

            if (Input.GetKeyDown(MouseAimSettings.FlightModeKeyCode))
            {
                flightMode.NextBehavior();
                ScreenMessages.PostScreenMessage("Flight Mode: " + flightMode.GetBehaviorName());
            }

            if (!mouseAimActive)
            {
                return;
            }

            UpdateMouseCursorForCameraRotation();
            UpdateVesselScreenLocation();
            UpdateCursorScreenLocation();
        }