Example #1
0
 private void Undock()
 {
     if (Docked)
     {
         Undocking = true;
         foreach (var connector in shipComponents.Connectors)
         {
             connector.Disconnect();
             connector.GetActionWithName("OnOff_On").Apply(connector);
         }
         undockPosition = Me.GetPosition() + (navigationSystems.RemoteControl.WorldMatrix.Forward * 30);
         navigationSystems.EnableFlightMode();
     }
     if (Undocking)
     {
         navigationSystems.Approach(undockPosition, 100);
         navigationSystems.AlignTo(undockPosition);
         navigationSystems.AlignUpWithGravity();
         var distance = (navigationSystems.RemoteControl.GetPosition() - undockPosition).Length();
         if (distance < 5)
         {
             Undocking = false;
         }
     }
 }