예제 #1
0
 void ToggleMouseAim() //Mouse aim must not be toggled by anything other than this function
 {
     mouseAimActive = !mouseAimActive;
     if (mouseAimActive)
     {
         Cursor.lockState = CursorLockMode.Locked;
         Cursor.visible   = false;
         ScreenMessages.PostScreenMessage("MAF Enabled: " + flightMode.GetBehaviorName());
     }
     else
     {
         Cursor.lockState = CursorLockMode.None;
         Cursor.visible   = true;
         ScreenMessages.PostScreenMessage("MAF Disabled");
     }
     targetPosition = vesselTransform.up * 5000f; //if it's activated, set it to the baseline
     UpdateCursorScreenLocation();
     TweakControlSurfaces(mouseAimActive);        //Remove when stock control surfaces are fixed
 }
예제 #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();
        }