コード例 #1
0
        public static CBAttributeMapSO.MapAttribute GetCurrentBiome(Vessel vessel)
        {
            CelestialBody celestialBody = vessel.mainBody;
            double        lattitude     = ResourceUtilities.Deg2Rad(vessel.latitude);
            double        longitude     = ResourceUtilities.Deg2Rad(vessel.longitude);

            CBAttributeMapSO.MapAttribute biome = ResourceUtilities.GetBiome(lattitude, longitude, FlightGlobals.currentMainBody);

            return(biome);
        }
コード例 #2
0
ファイル: Vessels.cs プロジェクト: yadenisyur/IndicatorLights
        /// <summary>
        /// Get the current biome of the ship. Returns null if none.
        /// </summary>
        /// <param name="vessel"></param>
        /// <returns></returns>
        public static string GetCurrentBiome(this Vessel vessel)
        {
            if (vessel == null)
            {
                return(null);
            }
            double lat = ResourceUtilities.Deg2Rad((vessel.latitude + 180.0 + 90.0) % 180.0 - 90.0);
            double lon = ResourceUtilities.Deg2Rad((vessel.longitude + 360.0 + 180.0) % 360.0 - 180.0);

            CBAttributeMapSO.MapAttribute biome = ResourceUtilities.GetBiome(lat, lon, vessel.mainBody);
            return((biome == null) ? null : biome.name);
        }
コード例 #3
0
ファイル: GeoLabView.cs プロジェクト: HebaruSan/WildBlueTools
        protected string getAbundance(string resourceName)
        {
            AbundanceRequest request   = new AbundanceRequest();
            double           lattitude = ResourceUtilities.Deg2Rad(this.part.vessel.latitude);
            double           longitude = ResourceUtilities.Deg2Rad(this.part.vessel.longitude);

            request.BiomeName    = Utils.GetCurrentBiome(this.part.vessel).name;
            request.BodyId       = this.part.vessel.mainBody.flightGlobalsIndex;
            request.Longitude    = longitude;
            request.Latitude     = lattitude;
            request.CheckForLock = true;
            request.ResourceName = resourceName;

            float abundance = ResourceMap.Instance.GetAbundance(request) * 100.0f;

            if (abundance > 0.001)
            {
                return(string.Format("{0:f2}%", abundance));
            }
            else
            {
                return("Unknown");
            }
        }