本文整理汇总了C#中CelestialBody.RealMaxAtmosphereAltitude方法的典型用法代码示例。如果您正苦于以下问题:C# CelestialBody.RealMaxAtmosphereAltitude方法的具体用法?C# CelestialBody.RealMaxAtmosphereAltitude怎么用?C# CelestialBody.RealMaxAtmosphereAltitude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CelestialBody
的用法示例。
在下文中一共展示了CelestialBody.RealMaxAtmosphereAltitude方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateAtmoTexture
//redraw the picture of the planned flight path
public static void UpdateAtmoTexture(Texture2D texture, CelestialBody mainBody, double maxAltitude, bool realAtmo = false)
{
double scale = maxAltitude / texture.height; //meters per pixel
double maxAtmosphereAltitude = mainBody.RealMaxAtmosphereAltitude();
double pressureSeaLevel = mainBody.atmospherePressureSeaLevel;
for (int y = 0; y < texture.height; y++)
{
double alt = scale * y;
if (realAtmo)
{
alt = mainBody.GetPressure(alt) / pressureSeaLevel;
}
else
{
alt = 1.0 - alt / maxAtmosphereAltitude;
}
float v = (float)(mainBody.atmosphere ? alt : 0.0F);
Color c = new Color(0.0F, 0.0F, v);
for (int x = 0; x < texture.width; x++)
{
texture.SetPixel(x, y, c);
if (mainBody.atmosphere && (int)(maxAtmosphereAltitude / scale) == y)
texture.SetPixel(x, y, XKCDColors.LightGreyBlue);
}
}
texture.Apply();
}
示例2: OnFixedUpdate
// public override void OnStart(PartModule.StartState state)
// {
// base.OnStart(state);
//
// fiSelRes = Type.GetType("Kethane.KethaneController").GetField("SelectedResource");
// }
public override void OnFixedUpdate()
{
// base.OnFixedUpdate();
if (HighLogic.LoadedScene != GameScenes.FLIGHT || KethaneData.Current == null) { return; }
if (lastBody != vessel.orbit.referenceBody) { // thanks to The_Duck, Technogeeky and ian for helping me fix the orbit calculation
lastBody = vessel.orbit.referenceBody;
// Debug.Log("GravParameter " + lastBody.gravParameter);
Orbits = new List<float>();
int y = 1;
var u3 = Math.Pow(lastBody.gravParameter, 1.0 / 3.0);
while (y > 0)
{
var oP = lastBody.rotationPeriod * (y / 80f);
var alt = u3 * Math.Pow(oP / (2 * Math.PI), 2.0 / 3.0) - lastBody.Radius;
var msg = string.Format("Orbit {0} is at {1:F1} km", y, alt / 1000f);
if (y % 2 != 0 && y % 5 != 0 && alt > 0 && alt < lastBody.sphereOfInfluence && (lastBody.atmosphere ? alt > lastBody.RealMaxAtmosphereAltitude() : true))
{
msg += " added";
Orbits.Add((float)alt / 1000f);
// Debug.Log(msg);
}
y++;
if (alt >= lastBody.sphereOfInfluence) { break; }
}
Orbits.Sort();
string str = "";
foreach (var o in Orbits)
{
str += o.ToString("#.0") + " km\n";
}
System.IO.File.WriteAllText(KSPUtil.ApplicationRootPath + "\\KethaneScanOrbits_" + lastBody.name + ".txt", str);
}
// var scans = KethaneData.Current.Scans[(string)fiSelRes.GetValue(null)][vessel.mainBody.name];
var scans = KethaneData.Current.Scans[MapOverlay.SelectedResource][vessel.mainBody.name];
Coverage = (float)Math.Floor(ordered.Count(c => scans[c]) / (float)ordered.Length * 100f * 100f) / 100f;
var cell = GetLowestUnscanned(scans);
if (Coverage == 100 && Active) {
print(vessel.mainBody.name + " completely scanned at " + vesselState.time);
TimeWarp.SetRate(0, false);
Active = false;
}
maxInc = CellToLonLat(cell).y;
if (Active)
{
var curInc = Math.Abs(maxInc);
var myInc = Math.Abs(vesselState.orbitInclination);
var diff = Math.Abs(myInc - curInc);
switch (Status)
{
case ControllerState.Inactive:
Status = ControllerState.Idle;
break;
case ControllerState.Idle:
if (diff > IncChangeStep && curInc >= IncChangeLimit && vessel.patchedConicSolver.maneuverNodes.Count == 0) {
var planner = core.GetComputerModule<MechJebModuleManeuverPlanner>();
double newInc;
if (ChangeByStep) {
newInc = vesselState.orbitInclination - (IncChangeStep * (vesselState.orbitInclination < 0 ? -1 : 1));
}
else
{
newInc = (curInc * (vesselState.orbitInclination < 0 ? -1 : 1));
}
newInc = Math.Round(newInc, 2);
var result = planner.PlanNode(MechJebModuleManeuverPlanner.Operation.INCLINATION,
MechJebModuleManeuverPlanner.TimeReference.EQ_ASCENDING, 0, 0, 0, newInc, 0, 0, 0, false);
if (result.Success && core.node != null) {
core.node.ExecuteOneNode(this);
}
else {
Active = false;
Status = ControllerState.Inactive;
print("KSC node planning error: " + result.Error + "\ntime error: " + result.TimeError);
}
warp = TimeWarp.CurrentRateIndex;
TimeWarp.SetRate(0, true);
Status = ControllerState.Waiting;
}
break;
case ControllerState.Waiting:
if (vessel.patchedConicSolver.maneuverNodes.Count == 0 && vessel.ctrlState.mainThrottle == 0)
{
TimeWarp.SetRate(warp, false);
//.........这里部分代码省略.........
开发者ID:BloodyRain2k,项目名称:MechJebKethaneSatCon,代码行数:101,代码来源:MechJebModuleKethaneSatelliteController.cs