コード例 #1
0
        public void EnableGuidance(KSPActionParam param)
        {
            controller          = new BLController(vessel, useFAR);
            reportedLandingGear = false;
            Changed(); // updates controller

            if ((tgtLatitude == 0) && (tgtLongitude == 0) && (tgtAlt == 0))
            {
                GuiUtils.ScreenMessage(Localizer.Format("#BoosterGuidance_NoTargetSet"));
                return;
            }
            if (!controller.enabled)
            {
                Debug.Log("[BoosterGuidance] Enabled Guidance for vessel " + FlightGlobals.ActiveVessel.name);
                Vessel vessel = FlightGlobals.ActiveVessel;
                Targets.RedrawTarget(vessel.mainBody, tgtLatitude, tgtLongitude, tgtAlt);
                vessel.Autopilot.Enable(VesselAutopilot.AutopilotMode.StabilityAssist);
                if (logging)
                {
                    StartLogging();
                }
                vessel.OnFlyByWire += new FlightInputCallback(Fly);
            }
            controller.SetPhase(BLControllerPhase.Unset);
            controller.enabled = true;
            AddController(controller);
        }
コード例 #2
0
 public void SetPhase(BLControllerPhase phase)
 {
     if (controller != null)
     {
         controller.SetPhase(phase);
     }
 }