当前位置: 首页>>代码示例>>C#>>正文


C# CelestialBody.RevealType方法代码示例

本文整理汇总了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;
                            }
                        }
                    }
                }
        }
开发者ID:Simoyd,项目名称:KSP-X-Science,代码行数:76,代码来源:Body.cs

示例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( );
		}
开发者ID:Karnmak,项目名称:KSP-X-Science,代码行数:60,代码来源:Body.cs

示例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;
                            }
                        }
                    }
                }
        }
开发者ID:jrossignol,项目名称:KSP-X-Science,代码行数:92,代码来源:Body.cs

示例4: IsSun

 public static bool IsSun(CelestialBody body)
 {
    return body.RevealType().Equals("Sun");
 }
开发者ID:Kerbas-ad-astra,项目名称:FinalFrontier,代码行数:4,代码来源:GameUtils.cs


注:本文中的CelestialBody.RevealType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。