public override void OnUpdate() { ORSPlanetaryResourceMapData.updatePlanetaryResourceMap(); if (resourceInfo == null) { if (ORSPlanetaryResourceMapData.getPlanetaryResourceMapData.ContainsKey(resourceName)) { resourceInfo = ORSPlanetaryResourceMapData.getPlanetaryResourceMapData[resourceName]; } } Events["DisplayResource"].active = Events["DisplayResource"].guiActive = !ORSPlanetaryResourceMapData.resourceIsDisplayed(resourceName) && mapViewAvailable; Events["DisplayResource"].guiName = "Display " + resourceName + " hotspots"; Events["HideResource"].active = Events["HideResource"].guiActive = ORSPlanetaryResourceMapData.resourceIsDisplayed(resourceName) && mapViewAvailable; Events["HideResource"].guiName = "Hide " + resourceName + " hotspots"; Fields["Ab"].guiName = resourceName + " abundance"; if (resourceInfo != null) { if (resourceInfo.getResourceScale() == 1) { Ab = (abundance * 100.0).ToString("0.00") + "%"; } else { Ab = (abundance * 1000000.0).ToString("0.0") + "ppm"; } } else { Ab = "Broken:("; } }
protected static double getPixelAbundanceValue(int pix_x, int pix_y, ORSPlanetaryResourceInfo resource_info) { Texture2D map = resource_info.getResourceMap(); Color pix_color = map.GetPixel(pix_x, pix_y); double resource_val = 0; double scale_factor = resource_info.getScaleFactor(); double scale_multiplier = resource_info.getScaleMultiplier(); if (resource_info.getResourceScale() == ORSPlanetaryResourceInfo.LOG_SCALE) { resource_val = Math.Pow(scale_factor, pix_color.grayscale * 255.0) / 1000000 * scale_multiplier; } else if (resource_info.getResourceScale() == ORSPlanetaryResourceInfo.LINEAR_SCALE) { resource_val = pix_color.grayscale * scale_multiplier; } return(resource_val); }
protected static double getPixelAbundanceValue(int pix_x, int pix_y, ORSPlanetaryResourceInfo resource_info) { Texture2D map = resource_info.getResourceMap(); Color pix_color = map.GetPixel(pix_x, pix_y); double resource_val = 0; double scale_factor = resource_info.getScaleFactor(); double scale_multiplier = resource_info.getScaleMultiplier(); if (resource_info.getResourceScale() == ORSPlanetaryResourceInfo.LOG_SCALE) { resource_val = Math.Pow(scale_factor, pix_color.grayscale * 255.0) / 1000000 * scale_multiplier; } else if (resource_info.getResourceScale() == ORSPlanetaryResourceInfo.LINEAR_SCALE) { resource_val = pix_color.grayscale * scale_multiplier; } return resource_val; }