本文整理汇总了C#中CelestialBody.RevealType方法的典型用法代码示例。如果您正苦于以下问题:C# CelestialBody.RevealType方法的具体用法?C# CelestialBody.RevealType怎么用?C# CelestialBody.RevealType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CelestialBody
的用法示例。
在下文中一共展示了CelestialBody.RevealType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Body
public Body( CelestialBody Body )
{
// Init
_logger = new Logger( "Body: " + Body.name );
// Store this!
_celestialBody = Body;
// Name
_name = Body.name;
// Biomes
_hasBiomes = false;
if( Body.BiomeMap != null )
_biomes = Body.BiomeMap.Attributes.Select( y => y.name ).ToArray( );
else
_biomes = new string[ 0 ];
if( _biomes.Length > 0 )
_hasBiomes = true;
// Surface
_hasSurface = Body.pqsController != null;
// Atmosphere
_hasAtmosphere = Body.atmosphere;
_hasOxygen = Body.atmosphereContainsOxygen;
// Ocean
_hasOcean = Body.ocean;
// Homeworld
_isHome = Body.isHomeWorld;
// Star detection
_isStar = Sun.Instance.sun.flightGlobalsIndex == Body.flightGlobalsIndex;
// GasGiant detection
_isGasGiant = !_isStar && !_hasSurface;
// Type
_type = Body.RevealType( ); // Not sure we can trust this
// Moon detection + Parent
_parent = null; // No parent - a star
if( Body.orbit != null && Body.orbit.referenceBody != null ) // Otherwise it is the sun
{
_parent = Body.orbit.referenceBody.flightGlobalsIndex;
if( Body.orbit.referenceBody.flightGlobalsIndex != Sun.Instance.sun.flightGlobalsIndex ) // A moon - parent isn't the sun
_isMoon = true;
}
// Reached - bit of a palaver but Body.DiscoveryInfo isn't useful
_Reached = null;
if( HighLogic.CurrentGame != null )
{
var node = new ConfigNode( );
var Progress = HighLogic.CurrentGame.scenarios.Find( s => s.moduleName == "ProgressTracking" );
Progress.Save( node );
ConfigNode[] P = node.GetNodes( "Progress" );
if( P.Count( ) > 0 )
{
ConfigNode[] B = P[ 0 ].GetNodes( _name );
if( B.Count( ) > 0 )
{
var V = B[ 0 ].GetValue( "reached" );
if( !string.IsNullOrEmpty( V ) )
{
double R;
if( double.TryParse( V, out R ) )
_Reached = R;
}
}
}
}
}
示例2: Body
// This could fail if some mode changes celestial bodies on the fly
// Just don't want to stick too much stuff into Update()
public Body( CelestialBody Body )
{
// Init
// _logger = new Logger( "Body: " + Body.name );
// Store this!
_celestialBody = Body;
// Name
_name = _celestialBody.name;
// Biomes
_hasBiomes = false;
if( _celestialBody.BiomeMap != null )
_biomes = _celestialBody.BiomeMap.Attributes.Select( y => y.name ).ToArray( );
else
_biomes = new string[ 0 ];
if( _biomes.Length > 0 )
_hasBiomes = true;
// Surface
_hasSurface = _celestialBody.pqsController != null;
// Atmosphere
_hasAtmosphere = _celestialBody.atmosphere;
_hasOxygen = _celestialBody.atmosphereContainsOxygen;
// Ocean
_hasOcean = _celestialBody.ocean;
// Homeworld
_isHome = _celestialBody.isHomeWorld;
// Star detection
_isStar = Sun.Instance.sun == Body;
// GasGiant detection
_isGasGiant = !_isStar && !_hasSurface;
// Type
_type = _celestialBody.RevealType( ); // Not sure we can trust this
// Moon detection + Parent
_parent = null; // No parent - a star
_isPlanet = _isMoon = false;
if( _celestialBody.orbit != null && _celestialBody.orbit.referenceBody != null ) // Otherwise it is the sun
{
_parent = _celestialBody.orbit.referenceBody;
if( _celestialBody.orbit.referenceBody == Sun.Instance.sun )
_isPlanet = true;
else
_isMoon = true; // A moon - parent isn't the sun
}
// Progress tracking changes
Update( );
}
示例3: Body
public Body( CelestialBody Body )
{
// Init
// _logger = new Logger( "Body: " + Body.name );
// Store this!
_celestialBody = Body;
// Name
_name = Body.name;
// Biomes
_hasBiomes = false;
if( Body.BiomeMap != null )
_biomes = Body.BiomeMap.Attributes.Select( y => y.name ).ToArray( );
else
_biomes = new string[ 0 ];
if( _biomes.Length > 0 )
_hasBiomes = true;
// Surface
_hasSurface = Body.pqsController != null;
// Atmosphere
_hasAtmosphere = Body.atmosphere;
_hasOxygen = Body.atmosphereContainsOxygen;
// Ocean
_hasOcean = Body.ocean;
// Homeworld
_isHome = Body.isHomeWorld;
// Star detection
_isStar = Sun.Instance.sun.flightGlobalsIndex == Body.flightGlobalsIndex;
// GasGiant detection
_isGasGiant = !_isStar && !_hasSurface;
// Type
_type = Body.RevealType( ); // Not sure we can trust this
// Moon detection + Parent
_parent = null; // No parent - a star
if( Body.orbit != null && Body.orbit.referenceBody != null ) // Otherwise it is the sun
{
_parent = Body.orbit.referenceBody.flightGlobalsIndex;
if( Body.orbit.referenceBody.flightGlobalsIndex != Sun.Instance.sun.flightGlobalsIndex ) // A moon - parent isn't the sun
_isMoon = true;
}
// Reached - bit of a palaver but Body.DiscoveryInfo isn't useful
_Reached = null; // Not reached yet
if( _isHome ) // KSP says you have to launch your first vessel to reach the homeworld
_Reached = 1; // I say the homeworld is always reached.
else
{
// If we are here then it's reached
// ProgressTracking node is slow to react.
// Maybe you need to change vessels to force the save
if( HighLogic.LoadedScene == GameScenes.FLIGHT )
{
if( FlightGlobals.ActiveVessel.mainBody.flightGlobalsIndex == Body.flightGlobalsIndex )
_Reached = 1;
}
}
// Do this whatever happened above then the "1" can be overwritten
// by the real thing
if( HighLogic.CurrentGame != null )
{
var node = new ConfigNode( );
var Progress = HighLogic.CurrentGame.scenarios.Find( s => s.moduleName == "ProgressTracking" );
Progress.Save( node );
ConfigNode[] P = node.GetNodes( "Progress" );
if( P.Count( ) > 0 )
{
ConfigNode[] B = P[ 0 ].GetNodes( _name );
if( B.Count( ) > 0 )
{
var V = B[ 0 ].GetValue( "reached" );
if( !string.IsNullOrEmpty( V ) )
{
double R;
if( double.TryParse( V, out R ) )
_Reached = R;
}
}
}
}
}
示例4: IsSun
public static bool IsSun(CelestialBody body)
{
return body.RevealType().Equals("Sun");
}