private void GetMineralBlipSprtCacheProps() { // Get the min/max values double minDollars = double.MaxValue; double maxDollars = double.MinValue; SortedList <MineralType, double> dollars = new SortedList <MineralType, double>(); foreach (MineralType mineralType in Enum.GetValues(typeof(MineralType))) { //decimal suggestedDollars = Mineral.GetSuggestedCredits(mineralType); decimal suggestedDollars = ItemOptionsAstMin2D.GetCredits_Mineral(mineralType); double suggestedDollarsScaled = Math.Sqrt(Convert.ToDouble(suggestedDollars)); // taking the square root, because the values are exponential, and I want the color scale more linear dollars.Add(mineralType, suggestedDollarsScaled); if (suggestedDollarsScaled < minDollars) { minDollars = suggestedDollarsScaled; } if (suggestedDollarsScaled > maxDollars) { maxDollars = suggestedDollarsScaled; } } // Store color based on those values _mineralColors = new SortedList <MineralType, MineralBlipProps>(); Color maxColor = Colors.Chartreuse; foreach (MineralType mineralType in Enum.GetValues(typeof(MineralType))) { Color diffuse, specular; double size; double dollar = dollars[mineralType]; double colorPercent = UtilityCore.GetScaledValue_Capped(.33d, 1d, minDollars, maxDollars, dollar); diffuse = UtilityWPF.AlphaBlend(maxColor, Colors.Transparent, colorPercent); specular = diffuse; //size = UtilityCore.GetScaledValue_Capped(2d, 5d, minDollars, maxDollars, dollar); size = UtilityCore.GetScaledValue_Capped(4d, 10d, minDollars, maxDollars, dollar); _mineralColors.Add(mineralType, new MineralBlipProps(diffuse, specular, size)); } }
public MapPopulationManager(Map map, World world, Point3D boundryMin, Point3D boundryMax, int material_Asteroid, int material_Mineral, Func <double, ITriangleIndexed[], double> getAsteroidMassByRadius, Func <double, MineralDNA[]> getMineralsByDestroyedMass, double minChildAsteroidRadius) { _map = map; _world = world; _boundry = new Boundry(boundryMin, boundryMax); _material_Asteroid = material_Asteroid; _material_Mineral = material_Mineral; _getAsteroidMassByRadius = getAsteroidMassByRadius; _getMineralsByDestroyedMass = getMineralsByDestroyedMass; _minChildAsteroidRadius = minChildAsteroidRadius; _mineralTypesByValue = ((MineralType[])Enum.GetValues(typeof(MineralType))). Select(o => new { Type = o, Value = ItemOptionsAstMin2D.GetCredits_Mineral(o) }). OrderBy(o => o.Value). Select(o => o.Type). ToArray(); }