Esempio n. 1
0
 public static FlightMap Load(string filename, GravityTurner turner)
 {
     try
     {
         Texture2D texture = new Texture2D(800, 400);
         texture.LoadImage(System.IO.File.ReadAllBytes(filename));
         FlightMap flightmap = new FlightMap(turner, texture.width, texture.height);
         flightmap.texture = texture;
         GravityTurner.Log("FlightMap loaded with {0:0.00} loss", args: flightmap.TotalLoss());
         return(flightmap);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 2
0
 public void Kill()
 {
     if (flightMapWindow.flightMap != null)
     {
         flightMapWindow.flightMap.WriteParameters(TurnAngle, StartSpeed);
         flightMapWindow.flightMap.WriteResults(DragLoss, GravityDragLoss, VectorLoss);
         Log("Flightmap with {0:0.00} loss", flightMapWindow.flightMap.TotalLoss());
         FlightMap previousLaunch = FlightMap.Load(GetFlightMapFilename(), this);
         if (getVessel.vesselName != "Untitled Space Craft" && // Don't save the default vessel name
             getVessel.altitude > getVessel.mainBody.atmosphereDepth &&
             (previousLaunch == null ||
              previousLaunch.BetterResults(DragLoss, GravityDragLoss, VectorLoss)))   // Only save the best result
         {
             flightMapWindow.flightMap.Save(GetFlightMapFilename());
         }
     }
     Launching              = false;
     getVessel.OnFlyByWire -= new FlightInputCallback(fly);
     FlightInputHandler.state.mainThrottle = 0;
     attitude.enabled = false;
     getVessel.ActionGroups.SetGroup(KSPActionGroup.SAS, false);
 }
Esempio n. 3
0
 public static FlightMap Load(string filename, GravityTurner turner)
 {
     try
     {
         Texture2D texture = new Texture2D(800, 400);
         texture.LoadImage(System.IO.File.ReadAllBytes(filename));
         FlightMap flightmap = new FlightMap(turner, texture.width, texture.height);
         flightmap.texture = texture;
         GravityTurner.Log("FlightMap loaded with {0:0.00} loss", args:flightmap.TotalLoss());
         return flightmap;
     }
     catch (Exception)
     {
         return null;
     }
 }