Beispiel #1
0
        private ModelVisual3D GetMineralBlip_OLD(Mineral mineral)
        {
            //if (mineral.Radius < 2)    // limit by value instead of size
            //{
            //    // No need to flood the map with tiny minerals
            //    return null;
            //}

            Color blipColor = Color.FromArgb(255, mineral.DiffuseColor.R, mineral.DiffuseColor.G, mineral.DiffuseColor.B);

            // Material
            MaterialGroup materials = new MaterialGroup();

            materials.Children.Add(new DiffuseMaterial(new SolidColorBrush(blipColor)));
            materials.Children.Add(new SpecularMaterial(new SolidColorBrush(blipColor), 100d));

            // Geometry Model
            GeometryModel3D geometry = new GeometryModel3D();

            geometry.Material     = materials;
            geometry.BackMaterial = materials;
            geometry.Geometry     = GetBlipGeometry();
            geometry.Transform    = new ScaleTransform3D(4, 4, 1);

            // Model Visual
            ModelVisual3D retVal = new ModelVisual3D();

            retVal.Content   = geometry;
            retVal.Transform = new TranslateTransform3D(mineral.PositionWorld.ToVector());

            // Exit Function
            return(retVal);
        }
Beispiel #2
0
        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)))
            {
                if (mineralType == MineralType.Custom)
                {
                    continue;
                }

                decimal suggestedDollars       = Mineral.GetSuggestedValue(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)))
            {
                MineralBlipProps props = new MineralBlipProps();

                if (mineralType == MineralType.Custom)
                {
                    props.DiffuseColor  = Colors.HotPink;     // not sure what to do here.  maybe I'll know more if I ever use custom minerals  :)
                    props.SpecularColor = props.DiffuseColor;
                    props.Size          = 4;
                }
                else
                {
                    double dollar = dollars[mineralType];

                    double colorPercent = UtilityCore.GetScaledValue_Capped(.33d, 1d, minDollars, maxDollars, dollar);
                    props.DiffuseColor  = UtilityWPF.AlphaBlend(maxColor, Colors.Transparent, colorPercent);
                    props.SpecularColor = props.DiffuseColor;

                    props.Size = UtilityCore.GetScaledValue_Capped(2d, 5d, minDollars, maxDollars, dollar);
                }

                _mineralColors.Add(mineralType, props);
            }
        }
Beispiel #3
0
        public bool CollideWithMineral(Mineral mineral)
        {
            bool retVal = false;

            //TODO:  Only try to add if the relative velocity is small enough

            if (_cargoBay.Add(mineral))
            {
                _physicsBody.Mass = Convert.ToSingle(this.TotalMass);

                _progressBarCargo.Value = _cargoBay.UsedVolume;

                retVal = true;
            }

            return(retVal);
        }
Beispiel #4
0
        private ModelVisual3D GetMineralBlip(Mineral mineral)
        {
            //if (mineral.Radius < 2)    // limit by value instead of size
            //{
            //    // No need to flood the map with tiny minerals
            //    return null;
            //}

            // Using the mineral's color makes the map look very busy.  Instead I will set an intensity of a solid color based on its relative value
            // in relation to the other minerals
            if (_mineralColors == null)
            {
                GetMineralBlipSprtCacheProps();
            }
            MineralBlipProps blipProps = _mineralColors[mineral.MineralType];

            // Material
            MaterialGroup materials = new MaterialGroup();

            materials.Children.Add(new DiffuseMaterial(new SolidColorBrush(blipProps.DiffuseColor)));
            materials.Children.Add(new SpecularMaterial(new SolidColorBrush(blipProps.SpecularColor), 100d));

            // Geometry Model
            GeometryModel3D geometry = new GeometryModel3D();

            geometry.Material     = materials;
            geometry.BackMaterial = materials;
            geometry.Geometry     = GetBlipGeometry();
            geometry.Transform    = new ScaleTransform3D(blipProps.Size, blipProps.Size, blipProps.Size * .25d);

            // Model Visual
            ModelVisual3D retVal = new ModelVisual3D();

            retVal.Content   = geometry;
            retVal.Transform = new TranslateTransform3D(mineral.PositionWorld.ToVector());

            // Exit Function
            return(retVal);
        }
Beispiel #5
0
 public decimal GetMineralValue(MineralType mineralType)
 {
     //TODO:  Slowly adjust my prices from the norm over time (maybe even have my own cargo bay that holds minerals)
     return(Mineral.GetSuggestedValue(mineralType));
 }
Beispiel #6
0
        private ModelVisual3D GetMineralBlip_OLD(Mineral mineral)
        {
            //if (mineral.Radius < 2)    // limit by value instead of size
            //{
            //    // No need to flood the map with tiny minerals
            //    return null;
            //}

            Color blipColor = Color.FromArgb(255, mineral.DiffuseColor.R, mineral.DiffuseColor.G, mineral.DiffuseColor.B);

            // Material
            MaterialGroup materials = new MaterialGroup();
            materials.Children.Add(new DiffuseMaterial(new SolidColorBrush(blipColor)));
            materials.Children.Add(new SpecularMaterial(new SolidColorBrush(blipColor), 100d));

            // Geometry Model
            GeometryModel3D geometry = new GeometryModel3D();
            geometry.Material = materials;
            geometry.BackMaterial = materials;
            geometry.Geometry = GetBlipGeometry();
            geometry.Transform = new ScaleTransform3D(4, 4, 1);

            // Model Visual
            ModelVisual3D retVal = new ModelVisual3D();
            retVal.Content = geometry;
            retVal.Transform = new TranslateTransform3D(mineral.PositionWorld.ToVector());

            // Exit Function
            return retVal;
        }
Beispiel #7
0
        private ModelVisual3D GetMineralBlip(Mineral mineral)
        {
            //if (mineral.Radius < 2)    // limit by value instead of size
            //{
            //    // No need to flood the map with tiny minerals
            //    return null;
            //}

            // Using the mineral's color makes the map look very busy.  Instead I will set an intensity of a solid color based on its relative value
            // in relation to the other minerals
            if (_mineralColors == null)
            {
                GetMineralBlipSprtCacheProps();
            }
            MineralBlipProps blipProps = _mineralColors[mineral.MineralType];

            // Material
            MaterialGroup materials = new MaterialGroup();
            materials.Children.Add(new DiffuseMaterial(new SolidColorBrush(blipProps.DiffuseColor)));
            materials.Children.Add(new SpecularMaterial(new SolidColorBrush(blipProps.SpecularColor), 100d));

            // Geometry Model
            GeometryModel3D geometry = new GeometryModel3D();
            geometry.Material = materials;
            geometry.BackMaterial = materials;
            geometry.Geometry = GetBlipGeometry();
            geometry.Transform = new ScaleTransform3D(blipProps.Size, blipProps.Size, blipProps.Size * .25d);

            // Model Visual
            ModelVisual3D retVal = new ModelVisual3D();
            retVal.Content = geometry;
            retVal.Transform = new TranslateTransform3D(mineral.PositionWorld.ToVector());

            // Exit Function
            return retVal;
        }
Beispiel #8
0
        public bool CollideWithMineral(Mineral mineral)
        {
            bool retVal = false;

            //TODO:  Only try to add if the relative velocity is small enough

            if (_cargoBay.Add(mineral))
            {
                _physicsBody.Mass = Convert.ToSingle(this.TotalMass);

                _progressBarCargo.Value = _cargoBay.UsedVolume;

                retVal = true;
            }

            return retVal;
        }