本文整理汇总了C#中CelestialBody.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# CelestialBody.GetName方法的具体用法?C# CelestialBody.GetName怎么用?C# CelestialBody.GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CelestialBody
的用法示例。
在下文中一共展示了CelestialBody.GetName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getCelestialState
public json getCelestialState(CelestialBody celestial)
{
Debug.Log ("Collecting: " + celestial.GetName ());
json buffer = new json ();
buffer.Add ("type", "celestial");
buffer.Add ("name", celestial.GetName ());
buffer.Add ("ref", celestial.referenceBody.GetName ());
if (celestial.orbitDriver != null) {
Orbit orbit = celestial.GetOrbit ();
Vector3d r = orbit.getRelativePositionAtUT (0);
Vector3d v = orbit.getOrbitalVelocityAtUT (0);
List<double> RV = new List<double> ();
// Swap coordinate system
RV.Add (r.y);
RV.Add (r.x);
RV.Add (r.z);
RV.Add (v.y);
RV.Add (v.x);
RV.Add (v.z);
buffer.Add ("rv", RV);
} else {
List<double> RV = new List<double> ();
RV.Add (0.0);
RV.Add (0.0);
RV.Add (0.0);
RV.Add (0.0);
RV.Add (0.0);
RV.Add (0.0);
buffer.Add ("rv", RV);
}
buffer.Add ("mu", celestial.gravParameter);
buffer.Add ("radius", celestial.Radius);
buffer.Add ("soi", celestial.sphereOfInfluence);
if (celestial.atmosphere == true) {
buffer.Add ("alt_atm", celestial.maxAtmosphereAltitude);
} else {
buffer.Add ("alt_atm", 0);
}
// Angular velocity data
buffer.Add ("ang_v", celestial.zUpAngularVelocity.magnitude);
buffer.Add ("initial_rotation", celestial.initialRotation);
buffer.Add ("rotation_angle", celestial.rotationAngle);
buffer.Add ("rotation_t0", Planetarium.GetUniversalTime ());
return buffer;
}
示例2: CelestialBodyGuid
// taken from RemoteTech's RTUtil
public static Guid CelestialBodyGuid(CelestialBody cb)
{
char[] name = cb.GetName().ToCharArray();
var s = new StringBuilder();
for (int i = 0; i < 16; i++)
{
s.Append(((short)name[i % name.Length]).ToString("x"));
}
return new Guid(s.ToString());
}
示例3: CelestialIsForbidden
protected static bool CelestialIsForbidden(CelestialBody body)
{
if (body == null)
return true;
List<string> forbidList = FPConfig.ISRU.ForbiddenCelestials.Replace(" ", "").Split(',').ToList();
foreach (string forbidden in forbidList)
{
if (body.GetName() == forbidden)
return true;
}
return false;
}
示例4: Generate
protected override bool Generate()
{
if (AreFacilitiesUnlocked() == false)
return false;
//Facility fails generation on duplicates, so we can't have many out at once.
int totalContracts = ContractSystem.Instance.GetCurrentContracts<FacilityContract>().Count();
if (totalContracts >= 2)
return false;
System.Random generator = new System.Random(this.MissionSeed);
//I'll use this to determine how "difficult" the mission is, and adjust the pricing at the end.
float difficultyFactor = 0.0f;
float scienceFactor = 1.0f;
float repFactor = 1.0f;
onLand = (generator.Next(0, 2) == 1);
if (onLand)
typeString = "land base";
else
typeString = "orbital station";
if (this.prestige == Contract.ContractPrestige.Trivial)
{
List<CelestialBody> bodies;
if (onLand)
bodies = GetBodies_Reached(false, false);
else
bodies = GetBodies_Reached(true, true);
if (bodies.Count == 0)
return false;
targetBody = bodies[generator.Next(0, bodies.Count)];
if (targetBody.GetName() == "Jool" && onLand)
{
targetBody = Util.RandomJoolianMoon();
if (targetBody.GetName() == "Jool" || targetBody == null)
return false;
}
if (onLand)
this.AddParameter(new LocationAndSituationParameter(targetBody, Vessel.Situations.LANDED, "base"), null);
else
this.AddParameter(new LocationAndSituationParameter(targetBody, Vessel.Situations.ORBITING, "station"), null);
this.AddParameter(new FacilitySystemsParameter(typeString), null);
this.AddParameter(new CrewCapacityParameter(5), null);
difficultyFactor = 5.0f / 4.0f;
capacity = 5;
if (Util.haveTechnology("cupola"))
{
if (generator.Next(0, 100) > 80)
{
this.AddParameter(new PartNameParameter("Have a viewing cupola at the facility", "cupola"), null);
difficultyFactor += 1.0f;
repFactor = 2.0f;
}
}
if (Util.haveTechnology("Large.Crewed.Lab"))
{
if (generator.Next(0, 100) > 80)
{
this.AddParameter(new FacilityLabParameter(), null);
difficultyFactor += 1.0f;
scienceFactor = 2.0f;
}
}
}
else if (this.prestige == Contract.ContractPrestige.Significant)
{
List<CelestialBody> bodies;
if (onLand)
bodies = GetBodies_Reached(false, false);
else
bodies = GetBodies_Reached(false, true);
if (bodies.Count == 0)
return false;
targetBody = bodies[generator.Next(0, bodies.Count)];
if (targetBody.GetName() == "Jool" && onLand)
{
targetBody = Util.RandomJoolianMoon();
if (targetBody.GetName() == "Jool" || targetBody == null)
return false;
}
if (onLand)
this.AddParameter(new LocationAndSituationParameter(targetBody, Vessel.Situations.LANDED, "base"), null);
else
this.AddParameter(new LocationAndSituationParameter(targetBody, Vessel.Situations.ORBITING, "station"), null);
//.........这里部分代码省略.........
示例5: Generate
protected override bool Generate()
{
if (AreWingsUnlocked() == false)
return false;
int offeredContracts = 0;
int activeContracts = 0;
foreach (AerialContract contract in ContractSystem.Instance.GetCurrentContracts<AerialContract>())
{
if (contract.ContractState == Contract.State.Offered)
offeredContracts++;
else if (contract.ContractState == Contract.State.Active)
activeContracts++;
}
if (offeredContracts >= FPConfig.Aerial.MaximumAvailable || activeContracts >= FPConfig.Aerial.MaximumActive)
return false;
double range = 10000.0;
System.Random generator = new System.Random(this.MissionSeed);
int additionalWaypoints = 0;
List<CelestialBody> allBodies = GetBodies_Reached(true, false);
List<CelestialBody> atmosphereBodies = new List<CelestialBody>();
foreach (CelestialBody body in allBodies)
{
if (body.atmosphere)
atmosphereBodies.Add(body);
}
if (atmosphereBodies.Count == 0)
return false;
targetBody = atmosphereBodies[generator.Next(0, atmosphereBodies.Count)];
//TODO: Find some common ground to calculate these values automatically without specific names.
switch (targetBody.GetName())
{
case "Jool":
additionalWaypoints = 0;
minAltitude = 15000.0;
maxAltitude = 30000.0;
break;
case "Duna":
additionalWaypoints = 1;
minAltitude = 8000.0;
maxAltitude = 16000.0;
break;
case "Laythe":
additionalWaypoints = 1;
minAltitude = 15000.0;
maxAltitude = 30000.0;
break;
case "Eve":
additionalWaypoints = 1;
minAltitude = 20000.0;
maxAltitude = 40000.0;
break;
case "Kerbin":
additionalWaypoints = 2;
minAltitude = 12500.0;
maxAltitude = 25000.0;
break;
default:
additionalWaypoints = 0;
minAltitude = 0.0;
maxAltitude = 10000.0;
break;
}
int waypointCount = 0;
float fundsMultiplier = 1;
float scienceMultiplier = 1;
float reputationMultiplier = 1;
float wpFundsMultiplier = 1;
float wpScienceMultiplier = 1;
float wpReputationMultiplier = 1;
double altitudeHalfQuarterRange = Math.Abs(maxAltitude - minAltitude) * 0.125;
double upperMidAltitude = ((maxAltitude + minAltitude) / 2.0) + altitudeHalfQuarterRange;
double lowerMidAltitude = ((maxAltitude + minAltitude) / 2.0) - altitudeHalfQuarterRange;
minAltitude = Math.Round((minAltitude + (generator.NextDouble() * (lowerMidAltitude - minAltitude))) / 100.0) * 100.0;
maxAltitude = Math.Round((upperMidAltitude + (generator.NextDouble() * (maxAltitude - upperMidAltitude))) / 100.0) * 100.0;
switch(this.prestige)
{
case ContractPrestige.Trivial:
waypointCount = FPConfig.Aerial.TrivialWaypoints;
waypointCount += additionalWaypoints;
range = FPConfig.Aerial.TrivialRange;
if (Util.IsGasGiant(targetBody))
{
if (generator.Next(0, 100) < FPConfig.Aerial.ExceptionalLowAltitudeChance/2)
{
minAltitude *= FPConfig.Aerial.ExceptionalLowAltitudeMultiplier;
maxAltitude *= FPConfig.Aerial.ExceptionalLowAltitudeMultiplier;
isLowAltitude = true;
}
}
//.........这里部分代码省略.........
示例6: LoadCB
private IEnumerator<YieldInstruction> LoadCB(ConfigNode node, CelestialBody body)
{
bool updateMass = false;
//OnGui();
#region CBChanges
print("Fixing CB " + node.name + " of radius " + body.Radius);
guiMinor = "CelestialBody";
//OnGui();
double origRadius = body.Radius;
double origAtmo = body.maxAtmosphereAltitude;
#region CBMassRadius
node.TryGetValue("bodyName", ref body.bodyName);
node.TryGetValue("bodyDescription", ref body.bodyDescription);
if (node.TryGetValue("Radius", ref body.Radius))
updateMass = true;
print("Radius ratio: " + body.Radius / origRadius);
if (node.TryGetValue("Mass", ref body.Mass))
{
MassToOthers(body);
}
if (node.TryGetValue("GeeASL", ref body.GeeASL))
{
GeeASLToOthers(body);
updateMass = false;
}
if (node.TryGetValue("gravParameter", ref body.gravParameter))
{
GravParamToOthers(body);
updateMass = false;
}
#endregion
#region CBAtmosphereTemperature
node.TryGetValue("atmosphericAmbientColor", ref body.atmosphericAmbientColor);
node.TryGetValue("atmosphere", ref body.atmosphere);
node.TryGetValue("atmosphereScaleHeight", ref body.atmosphereScaleHeight);
node.TryGetValue("atmosphereMultiplier", ref body.atmosphereMultiplier);
node.TryGetValue("maxAtmosphereAltitude", ref body.maxAtmosphereAltitude);
node.TryGetValue("staticPressureASL", ref body.staticPressureASL);
node.TryGetValue("useLegacyAtmosphere", ref body.useLegacyAtmosphere);
if (!body.useLegacyAtmosphere)
{
ConfigNode PCnode = node.GetNode("pressureCurve");
if (PCnode != null)
{
body.altitudeMultiplier = 1f;
body.pressureMultiplier = 1f;
AnimationCurve pressureCurve = Utils.LoadAnimationCurve(PCnode);
if (pressureCurve != null)
body.pressureCurve = pressureCurve;
else
{
body.useLegacyAtmosphere = true;
Debug.LogWarning("Unable to load pressureCurve data for " + body.name + ": Using legacy atmosphere");
}
print("*RSS* finished with " + body.GetName() + ".pressureCurve (" + body.pressureCurve.keys.Length.ToString() + " keys)");
}
else
{
print("*RSS* useLegacyAtmosphere = False but pressureCurve not found!");
}
}
if (node.HasNode("temperatureCurve"))
{
ConfigNode TCnode = node.GetNode("temperatureCurve");
if (TCnode != null)
{
AnimationCurve temperatureCurve = Utils.LoadAnimationCurve(TCnode);
if (temperatureCurve != null)
{
body.temperatureCurve = temperatureCurve;
// Following two lines corrects situations where planets without atmosphere's have these two fields zeroed out
// Maybe think about making these configurable in the planet's config node? yes? no? meh?
body.atmoshpereTemperatureMultiplier = 1f;
body.altitudeMultiplier = 1f;
print("*RSS* found and loaded temperatureCurve data for " + body.name);
}
}
}
#endregion
#region CBRotation
node.TryGetValue("rotationPeriod", ref body.rotationPeriod);
node.TryGetValue("tidallyLocked", ref body.tidallyLocked);
node.TryGetValue("initialRotation", ref body.initialRotation);
node.TryGetValue("inverseRotation", ref body.inverseRotation);
#endregion
if (updateMass)
GeeASLToOthers(body);
/*if (node.HasValue("axialTilt"))
{
if (!body.inverseRotation && double.TryParse(node.GetValue("axialTilt"), out dtmp))
{
CBRotationFixer.CBRotations.Add(body.name, new CBRotation(body.name, dtmp, body.rotationPeriod, body.initialRotation));
//.........这里部分代码省略.........
示例7: ModifyPlanet
private void ModifyPlanet(CelestialBody oldB, CelestialBody newB)
{
Debug.Log("Planitron: ModifyPlanet oldB.GetName() = " + oldB.GetName());
Debug.Log("Planitron: ModifyPlanet newB.GetName() = " + newB.GetName());
_currentPlanetName = newB.GetName();
RoundedGeeASL = newB.GeeASL;
RoundedGeeASL = Math.Round(RoundedGeeASL, 2);
_currentGee = RoundedGeeASL.ToString();
if (newB.atmosphere)
{
_currentatmosphereMultiplier = newB.atmosphereMultiplier.ToString();
}
else
{
_currentatmosphereMultiplier = "None";
}
_currentOxygen = newB.atmosphereContainsOxygen;
oldB.atmoshpereTemperatureMultiplier = newB.atmoshpereTemperatureMultiplier;
oldB.atmosphere = newB.atmosphere;
oldB.atmosphereContainsOxygen = newB.atmosphereContainsOxygen;
oldB.atmosphereMultiplier = newB.atmosphereMultiplier;
oldB.atmosphereScaleHeight = newB.atmosphereScaleHeight;
col_R = newB.atmosphericAmbientColor.r;
col_G = newB.atmosphericAmbientColor.g;
col_B = newB.atmosphericAmbientColor.b;
col_A = newB.atmosphericAmbientColor.a;
col_RGBA = new Color(col_R, col_G, col_B, col_A);
oldB.atmosphericAmbientColor = col_RGBA;
oldB.GeeASL = newB.GeeASL;
oldB.gMagnitudeAtCenter = newB.gMagnitudeAtCenter;
oldB.gravParameter = newB.gravParameter;
oldB.Mass = newB.Mass;
oldB.pressureMultiplier = newB.pressureMultiplier;
oldB.staticPressureASL = newB.staticPressureASL;
Debug.Log(" ");
Debug.Log("Planitron: ModifyPlanet: New Values for vessel.mainBody ----------------------------");
Debug.Log("Planitron: ModifyPlanet Post Name = " + oldB.GetName());
Debug.Log("Planitron: ModifyPlanet Post atmoshpereTemperatureMultiplier = " + oldB.atmoshpereTemperatureMultiplier);
Debug.Log("Planitron: ModifyPlanet Post atmosphere = " + oldB.atmosphere);
Debug.Log("Planitron: ModifyPlanet Post atmosphereContainsOxygen = " + oldB.atmosphereContainsOxygen);
Debug.Log("Planitron: ModifyPlanet Post atmosphereMultiplier = " + oldB.atmosphereMultiplier);
Debug.Log("Planitron: ModifyPlanet Post atmosphereScaleHeight = " + oldB.atmosphereScaleHeight);
Debug.Log("Planitron: ModifyPlanet Post col_RGBA.ToString = " + col_RGBA.ToString());
Debug.Log("Planitron: ModifyPlanet Post col_RGBA = " + col_RGBA);
Debug.Log("Planitron: ModifyPlanet Post atmosphericAmbientColor = " + oldB.atmosphericAmbientColor.ToString());
Debug.Log("Planitron: ModifyPlanet Post GeeASL = " + oldB.GeeASL);
Debug.Log("Planitron: ModifyPlanet Post gMagnitudeAtCenter = " + oldB.gMagnitudeAtCenter);
Debug.Log("Planitron: ModifyPlanet Post gravParameter = " + oldB.gravParameter);
Debug.Log("Planitron: ModifyPlanet Post Mass = " + oldB.Mass);
Debug.Log("Planitron: ModifyPlanet Post pressureMultiplier = " + oldB.pressureMultiplier);
Debug.Log("Planitron: ModifyPlanet Post staticPressureASL = " + oldB.staticPressureASL);
Debug.Log(" ");
Debug.Log(" ");
}
开发者ID:philotical,项目名称:PlanitronReloaded,代码行数:58,代码来源:PlanitronReloaded_v0.0.03.06_stable_final_released.cs
示例8: doScience
public void doScience(CelestialBody target)
{
print("DOING SCIENCE, " + target.GetName());
ScienceExperiment experiment = ResearchAndDevelopment.GetExperiment(experimentID);
ScienceSubject subject = ResearchAndDevelopment.GetExperimentSubject(experiment, ExperimentSituations.InSpaceHigh, target, "");
float sciTrans = Mathf.Max(subject.scientificValue - (1f - (opticsModule.isSmallOptics ? 0.10f : maxScience)), 0.0f);
if (sciTrans == subject.scientificValue)
fullRecovery = true;
print("Current sciTrans: " + sciTrans);
ScienceData data = new ScienceData(Mathf.Max(experiment.baseValue * subject.dataScale * sciTrans, 0.001f), 1.0f, 0.0f, subject.id, pName + " " + target.bodyName + " Observation");
storedPath = opticsModule.GetTex(true, target.bodyName);
storedData.Add(data);
Events["eventReviewScience"].active = true;
Events["eventDumpData"].active = true;
eventReviewScience();
}
示例9: Generate
protected override bool Generate()
{
if (AreWheelsUnlocked() == false)
return false;
//Allow four contracts in pocket but only two on the board at a time.
int offeredContracts = 0;
int activeContracts = 0;
foreach (RoverContract contract in ContractSystem.Instance.GetCurrentContracts<RoverContract>())
{
if (contract.ContractState == Contract.State.Offered)
offeredContracts++;
else if (contract.ContractState == Contract.State.Active)
activeContracts++;
}
if (offeredContracts >= 2 || activeContracts >= 4)
return false;
System.Random generator = new System.Random(this.MissionSeed);
double range = 10000.0;
List<CelestialBody> bodies = GetBodies_Reached(true, false);
if (bodies.Count == 0)
return false;
targetBody = bodies[generator.Next(0, bodies.Count)];
if (targetBody.GetName() == "Jool")
{
targetBody = Util.RandomJoolianMoon();
if (targetBody.GetName() == "Jool" || targetBody == null)
return false;
}
int waypointCount = 0;
if (this.prestige == Contract.ContractPrestige.Trivial)
{
waypointCount = 3;
range = 1000 + 1000 * targetBody.GeeASL;
}
else if (this.prestige == Contract.ContractPrestige.Significant)
{
waypointCount = 5;
range = 2000 + 2000 * targetBody.GeeASL;
}
else if (this.prestige == Contract.ContractPrestige.Exceptional)
{
waypointCount = 7;
range = 3000 + 3000 * targetBody.GeeASL;
}
WaypointManager.ChooseRandomPosition(out centerLatitude, out centerLongitude, targetBody.GetName(), false);
int secret = UnityEngine.Random.Range(0, waypointCount);
for (int x = 0; x < waypointCount; x++)
{
ContractParameter newParameter;
if (x == secret)
newParameter = this.AddParameter(new RoverWaypointParameter(x, targetBody, centerLatitude, centerLongitude, range, true), null);
else
newParameter = this.AddParameter(new RoverWaypointParameter(x, targetBody, centerLatitude, centerLongitude, range, false), null);
newParameter.SetFunds(5000.0f, targetBody);
newParameter.SetReputation(10.0f, targetBody);
newParameter.SetScience(10.0f, targetBody);
}
base.AddKeywords(new string[] { "roversearch" });
base.SetExpiry();
base.SetDeadlineYears(5.0f, targetBody);
base.SetFunds(4000.0f, 17500.0f, targetBody);
base.SetReputation(50.0f, 25.0f, targetBody);
return true;
}
示例10: Generate
protected override bool Generate()
{
if (AreWingsUnlocked() == false)
return false;
//Allow four contracts in pocket but only two on the board at a time.
int offeredContracts = 0;
int activeContracts = 0;
foreach (AerialContract contract in ContractSystem.Instance.GetCurrentContracts<AerialContract>())
{
if (contract.ContractState == Contract.State.Offered)
offeredContracts++;
else if (contract.ContractState == Contract.State.Active)
activeContracts++;
}
if (offeredContracts >= 2 || activeContracts >= 4)
return false;
double range = 10000.0;
System.Random generator = new System.Random(this.MissionSeed);
int additionalWaypoints = 0;
List<CelestialBody> allBodies = GetBodies_Reached(true, false);
List<CelestialBody> atmosphereBodies = new List<CelestialBody>();
foreach (CelestialBody body in allBodies)
{
if (body.atmosphere)
atmosphereBodies.Add(body);
}
if (atmosphereBodies.Count == 0)
return false;
targetBody = atmosphereBodies[UnityEngine.Random.Range(0, atmosphereBodies.Count)];
switch (targetBody.GetName())
{
case "Jool":
additionalWaypoints = 0;
minAltitude = 15000.0;
maxAltitude = 30000.0;
break;
case "Duna":
additionalWaypoints = 1;
minAltitude = 8000.0;
maxAltitude = 16000.0;
break;
case "Laythe":
additionalWaypoints = 1;
minAltitude = 15000.0;
maxAltitude = 30000.0;
break;
case "Eve":
additionalWaypoints = 1;
minAltitude = 20000.0;
maxAltitude = 40000.0;
break;
case "Kerbin":
additionalWaypoints = 2;
minAltitude = 12500.0;
maxAltitude = 25000.0;
break;
default:
additionalWaypoints = 0;
minAltitude = 0.0;
maxAltitude = 10000.0;
break;
}
int waypointCount = 0;
double altitudeHalfQuarterRange = Math.Abs(maxAltitude - minAltitude) * 0.125;
double upperMidAltitude = ((maxAltitude + minAltitude) / 2.0) + altitudeHalfQuarterRange;
double lowerMidAltitude = ((maxAltitude + minAltitude) / 2.0) - altitudeHalfQuarterRange;
minAltitude = Math.Round((minAltitude + (generator.NextDouble() * (lowerMidAltitude - minAltitude))) / 100.0) * 100.0;
maxAltitude = Math.Round((upperMidAltitude + (generator.NextDouble() * (maxAltitude - upperMidAltitude))) / 100.0) * 100.0;
if (this.prestige == Contract.ContractPrestige.Trivial)
{
waypointCount = 1;
waypointCount += additionalWaypoints;
range = 100000.0;
}
else if (this.prestige == Contract.ContractPrestige.Significant)
{
waypointCount = 2;
waypointCount += additionalWaypoints;
range = 200000.0;
}
else if (this.prestige == Contract.ContractPrestige.Exceptional)
{
waypointCount = 3;
waypointCount += additionalWaypoints;
range = 300000.0;
}
WaypointManager.ChooseRandomPosition(out centerLatitude, out centerLongitude, targetBody.GetName(), true);
for (int x = 0; x < waypointCount; x++)
{
//.........这里部分代码省略.........