本文整理汇总了C#中CelestialBody类的典型用法代码示例。如果您正苦于以下问题:C# CelestialBody类的具体用法?C# CelestialBody怎么用?C# CelestialBody使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CelestialBody类属于命名空间,在下文中一共展示了CelestialBody类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Overlay
public Overlay(string planet, float altitude, Material scaledMaterial, Material macroMaterial, Vector2 rotation, int layer, Transform celestialTransform, bool mainMenu, bool matchTerrain)
{
this.MainMenu = mainMenu;
this.OverlayGameObject = new GameObject();
this.Body = planet;
this.Rotation = rotation;
this.scaledMaterial = scaledMaterial;
this.macroMaterial = macroMaterial;
this.OriginalLayer = layer;
this.celestialTransform = celestialTransform;
this.altitude = altitude;
this.matchTerrain = matchTerrain;
CelestialBody[] celestialBodies = (CelestialBody[])CelestialBody.FindObjectsOfType(typeof(CelestialBody));
celestialBody = celestialBodies.First(n => n.bodyName == this.Body);
if (!mainMenu && matchTerrain)
{
IsoSphere.Create(OverlayGameObject, this.altitude, celestialBody);
}
else
{
IsoSphere.Create(OverlayGameObject, this.Radius, null);
}
var mr = OverlayGameObject.AddComponent<MeshRenderer>();
mr.sharedMaterial = scaledMaterial;
mr.castShadows = false;
mr.receiveShadows = false;
//mr.enabled = mainMenu;
mr.enabled = true;
}
示例2: PowerUpDarkSide
public PowerUpDarkSide(Simulator simulator)
: base(simulator)
{
Type = PowerUpType.DarkSide;
Category = PowerUpCategory.Other;
BuyImage = "darkside";
BuyPrice = 500;
BuyTitle = "Dark side (" + BuyPrice + "M$)";
BuyDescription = "Enemies are hit by a mysterious force when they go behind a planet.";
NeedInput = false;
Position = Vector3.Zero;
CorpsCeleste = new CelestialBody(
Simulation,
"",
Vector3.Zero,
Vector3.Zero,
0,
Size.Small,
float.MaxValue,
null,
0,
0,
false);
CorpsCeleste.AttackPoints = 0.5f;
SfxIn = "sfxDarkSide";
}
示例3: progressBodyCollection
public progressBodyCollection(CelestialBodySubtree b)
{
body = b.Body;
if (b.Body.isHomeWorld)
{
homeworld = true;
}
else
{
addProgressStandard(ProgressType.FLIGHT, b.Body, b.flight, progressParser.flightDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.flight));
addProgressStandard(ProgressType.SUBORBIT, b.Body, b.suborbit, progressParser.suborbitDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.suborbit));
addProgressStandard(ProgressType.FLYBY, b.Body, b.flyBy, progressParser.flybyDescriptor);
addProgressStandard(ProgressType.FLYBYRETURN, b.Body, b.returnFromFlyby, progressParser.returnFlybyDescriptor, progressParser.RecoveryNote, progressParser.vesselNameFromNode(b.returnFromFlyby));
addProgressStandard(ProgressType.LANDINGRETURN, b.Body, b.returnFromSurface, progressParser.returnLandingDescriptor, progressParser.RecoveryNote, progressParser.vesselNameFromNode(b.returnFromSurface));
}
addProgressStandard(ProgressType.ESCAPE, b.Body, b.escape, progressParser.escapeDescriptor);
addProgressStandard(ProgressType.BASECONSTRUCTION, b.Body, b.baseConstruction, progressParser.baseDescriptor, progressParser.FacilityNote, progressParser.vesselNameFromNode(b.baseConstruction));
addProgressStandard(ProgressType.CREWTRANSFER, b.Body, b.crewTransfer, progressParser.crewTransferDescriptor);
addProgressStandard(ProgressType.DOCKING, b.Body, b.docking, progressParser.dockingDescriptor);
addProgressStandard(ProgressType.FLAGPLANT, b.Body, b.flagPlant, progressParser.flagDescriptor);
addProgressStandard(ProgressType.LANDING, b.Body, b.landing, progressParser.landingDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.landing));
addProgressStandard(ProgressType.ORBIT, b.Body, b.orbit, progressParser.orbitDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.orbit));
addProgressStandard(ProgressType.ORBITRETURN, b.Body, b.returnFromOrbit, progressParser.returnOrbitDescriptor, progressParser.RecoveryNote, progressParser.vesselNameFromNode(b.returnFromOrbit));
addProgressStandard(ProgressType.RENDEZVOUS, b.Body, b.rendezvous, progressParser.rendezvousDescriptor);
addProgressStandard(ProgressType.SCIENCE, b.Body, b.science, progressParser.scienceDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.science));
addProgressStandard(ProgressType.SPACEWALK, b.Body, b.spacewalk, progressParser.spacewalkDescriptor, progressParser.CrewNote, progressParser.crewNameFromNode(b.spacewalk));
addProgressStandard(ProgressType.SPLASHDOWN, b.Body, b.splashdown, progressParser.splashdownDescriptor);
addProgressStandard(ProgressType.STATIONCONSTRUCTION, b.Body, b.stationConstruction, progressParser.stationDescriptor, progressParser.FacilityNote, progressParser.vesselNameFromNode(b.stationConstruction));
addProgressStandard(ProgressType.SURFACEEVA, b.Body, b.surfaceEVA, progressParser.EVADescriptor, progressParser.CrewNote, progressParser.crewNameFromNode(b.surfaceEVA));
}
示例4: DrawMapViewGroundMarker
public static void DrawMapViewGroundMarker(CelestialBody body, double latitude, double longitude, Color c, double rotation = 0, double radius = 0)
{
Vector3d up = body.GetSurfaceNVector(latitude, longitude);
var height = body.pqsController.GetSurfaceHeight(QuaternionD.AngleAxis(longitude, Vector3d.down) * QuaternionD.AngleAxis(latitude, Vector3d.forward) * Vector3d.right);
if (height < body.Radius) { height = body.Radius; }
Vector3d center = body.position + height * up;
if (IsOccluded(center, body)) return;
Vector3d north = Vector3d.Exclude(up, body.transform.up).normalized;
if (radius <= 0) { radius = body.Radius / 15; }
GLTriangleMap(new Vector3d[]{
center,
center + radius * (QuaternionD.AngleAxis(rotation - 10, up) * north),
center + radius * (QuaternionD.AngleAxis(rotation + 10, up) * north)
}, c);
GLTriangleMap(new Vector3d[]{
center,
center + radius * (QuaternionD.AngleAxis(rotation + 110, up) * north),
center + radius * (QuaternionD.AngleAxis(rotation + 130, up) * north)
}, c);
GLTriangleMap(new Vector3d[]{
center,
center + radius * (QuaternionD.AngleAxis(rotation - 110, up) * north),
center + radius * (QuaternionD.AngleAxis(rotation - 130, up) * north)
}, c);
}
示例5: GetModel
public static VesselAerodynamicModel GetModel(Vessel ship, CelestialBody body)
{
foreach (var loadedAssembly in AssemblyLoader.loadedAssemblies)
{
try
{
switch (loadedAssembly.name)
{
case "FerramAerospaceResearch":
var FARAPIType = loadedAssembly.assembly.GetType("FerramAerospaceResearch.FARAPI");
var FARAPI_CalculateVesselAeroForces = FARAPIType.GetMethodEx("CalculateVesselAeroForces", BindingFlags.Public | BindingFlags.Static, new Type[] { typeof(Vessel), typeof(Vector3).MakeByRefType(), typeof(Vector3).MakeByRefType(), typeof(Vector3), typeof(double) });
return new FARModel(ship, body, FARAPI_CalculateVesselAeroForces);
//case "MyModAssembly":
// implement here your atmo mod detection
// return new MyModModel(ship, body, any other parameter);
}
}
catch (Exception e)
{
Debug.Log("Trajectories: failed to interface with assembly " + loadedAssembly.name);
Debug.Log("Using stock model instead");
Debug.Log(e.ToString());
}
}
// Using stock model if no other aerodynamic is detected or if any error occured
return new StockModel(ship, body);
}
示例6: GetNorthVector
public static Vector3 GetNorthVector(Vector3 position, CelestialBody body)
{
Vector3 geoPosA = VectorUtils.WorldPositionToGeoCoords(position, body);
Vector3 geoPosB = new Vector3(geoPosA.x+1, geoPosA.y, geoPosA.z);
Vector3 north = GetWorldSurfacePostion(geoPosB, body)-GetWorldSurfacePostion(geoPosA, body);
return Vector3.ProjectOnPlane(north, body.GetSurfaceNVector(geoPosA.x, geoPosA.y)).normalized;
}
示例7: GetPressure
public static double GetPressure(Vector3 position, CelestialBody body)
{
double latitude = body.GetLatitude(position) / 180.0 * Math.PI;
double altitude = (position - body.position).magnitude - body.Radius;
return GetPressure(altitude, latitude, body);
}
示例8: CreateOrbit
private static Orbit CreateOrbit(double inc, double e, double sma, double lan, double w, double mEp, double epoch, CelestialBody body)
{
if (double.IsNaN(inc))
inc = 0;
if (double.IsNaN(e))
e = 0;
if (double.IsNaN(sma))
sma = body.Radius + body.maxAtmosphereAltitude + 10000;
if (double.IsNaN(lan))
lan = 0;
if (double.IsNaN(w))
w = 0;
if (double.IsNaN(mEp))
mEp = 0;
if (double.IsNaN(epoch))
mEp = Planetarium.GetUniversalTime();
if (Math.Sign(e - 1) == Math.Sign(sma))
sma = -sma;
if (Math.Sign(sma) >= 0)
{
while (mEp < 0)
mEp += Math.PI * 2;
while (mEp > Math.PI * 2)
mEp -= Math.PI * 2;
}
return new Orbit(inc, e, sma, lan, w, mEp, epoch, body);
}
示例9: Start
void Start() {
if ( !Target ) {
var ship = GameObject.Find( "Ship" );
if ( ship ) {
Target = ship.GetComponentInParent<CelestialBody>();
}
}
_defaultTimeScale = SimulationControl.instance.TimeScale;
if ( timeScaleButtons.Length == 3 ) {
timeScaleButtons[0].interactable = false;
}
if ( !ShipControl ) {
ShipControl = Target.GetComponent<ShipController>();
}
if ( !FuelSlider ) {
Debug.Log("SpaceGravity2D.ShipGUI: fuel slider ref is null");
} else {
FuelSlider.maxValue = ShipControl.MaxFuel;
FuelSlider.value = ShipControl.Fuel;
}
if ( MarkPrefab ) {
_markApoapsis = Instantiate( MarkPrefab ) as Transform;
_markApoapsis.name = "apoapsisMark";
_markApoapsis.GetComponentInChildren<Text>().text = "A";
_markPeriapsis = Instantiate( MarkPrefab ) as Transform;
_markPeriapsis.name = "periapsisMark";
_markPeriapsis.GetComponentInChildren<Text>().text = "P";
}
}
示例10: Complex
public static void Complex(OrbitDriver currentlyEditing, double inclination, double eccentricity,
double semiMajorAxis, double longitudeAscendingNode, double argumentOfPeriapsis,
double meanAnomalyAtEpoch, double epoch, CelestialBody body)
{
SetOrbit(currentlyEditing, CreateOrbit(inclination, eccentricity, semiMajorAxis,
longitudeAscendingNode, argumentOfPeriapsis, meanAnomalyAtEpoch, epoch, body));
}
示例11: getMaxAtmosphericAltitude
public static float getMaxAtmosphericAltitude(CelestialBody body)
{
if (!body.atmosphere) return 0;
//return (float)-body.atmosphereScaleHeight * 1000.0f * Mathf.Log(1e-6f);
return (float)-body.atmosphereDepth * 1000.0f * Mathf.Log(1e-6f);
}
示例12: CelestialBodyCoverageParameter
public CelestialBodyCoverageParameter(double coverage, CelestialBody targetBody, string title = null)
: base(title)
{
this.coverage = coverage;
this.targetBody = targetBody;
disableOnStateChange = false;
}
示例13: PerformOrbitalSurvey
public PerformOrbitalSurvey(string title, CelestialBody targetBody)
: base(title)
{
disableOnStateChange = true;
this.targetBody = targetBody;
}
示例14: Start
protected override void Start()
{
//Initialize the map object
Visible = SCANcontroller.controller.bigMapVisible;
if (v == null)
v = FlightGlobals.ActiveVessel;
if (b == null)
b = v.mainBody;
if (bigmap == null)
{
bigmap = new SCANmap(b, true);
bigmap.setProjection((MapProjection)SCANcontroller.controller.projection);
bigmap.setWidth(SCANcontroller.controller.map_width);
}
WindowRect.x = SCANcontroller.controller.map_x;
WindowRect.y = SCANcontroller.controller.map_y;
currentColor = SCANcontroller.controller.colours == 0;
lastColor = currentColor;
lastResource = SCANcontroller.controller.map_ResourceOverlay;
WindowCaption = string.Format("Map of {0}", b.theName);
data = SCANUtil.getData(b);
if (data == null)
{
data = new SCANdata(b);
SCANcontroller.controller.addToBodyData(b, data);
}
bigmap.setBody(b);
if (SCANconfigLoader.GlobalResource)
{
loadedResources = SCANcontroller.setLoadedResourceList();
}
TooltipsEnabled = SCANcontroller.controller.toolTips;
}
示例15: LocationAndSituationParameter
public LocationAndSituationParameter()
{
targetSituation = Vessel.Situations.ESCAPING;
targetBody = null;
noun = "potato";
this.successCounter = 0;
}