kOS.Binding.FlightControlManager.SelectAutopilotMode C# (CSharp) Method

SelectAutopilotMode() public method

public SelectAutopilotMode ( VesselAutopilot autopilotMode ) : void
autopilotMode VesselAutopilot
return void
        public void SelectAutopilotMode(VesselAutopilot.AutopilotMode autopilotMode)
        {
            if (currentVessel.Autopilot.Mode != autopilotMode)
            {
                if (!currentVessel.Autopilot.CanSetMode(autopilotMode))
                {
                    // throw an exception if the mode is not available
                    throw new KOSSituationallyInvalidException(
                        string.Format("Cannot set autopilot value, pilot/probe does not support {0}, or there is no node/target", autopilotMode));
                }
                currentVessel.Autopilot.SetMode(autopilotMode);
                //currentVessel.Autopilot.Enable();
                // change the autopilot indicator
                ((kOSProcessor)Shared.Processor).SetAutopilotMode((int)autopilotMode);
                if (RemoteTechHook.IsAvailable(currentVessel.id))
                {
                    //Debug.Log(string.Format("kOS: Adding RemoteTechPilot: autopilot For : " + currentVessel.id));
                    // TODO: figure out how to make RemoteTech allow the built in autopilot control.  This may require modification to RemoteTech itself.
                }
            }
        }

Same methods

FlightControlManager::SelectAutopilotMode ( object autopilotMode ) : void
FlightControlManager::SelectAutopilotMode ( string autopilotMode ) : void

Usage Example

Exemplo n.º 1
0
 public void SelectAutopilotMode(string autopilotMode)
 {
     if (flightControl != null)
     {
         flightControl.SelectAutopilotMode(autopilotMode);
     }
 }