protected override List <List <(float x, float y, float z, Color color, bool isHovered)> > GetQuadList(MapObjectHoverData hoverData)
        {
            (float posAngleX, float posAngleY, float posAngleZ, float posAngleAngle) =
                ((float, float, float, float))_posAngle.GetValues();

            int xMin = (short)posAngleX;
            int xMax = xMin + (posAngleX >= 0 ? 1 : -1);
            int zMin = (short)posAngleZ;
            int zMax = zMin + (posAngleZ >= 0 ? 1 : -1);

            bool isHovered = this == hoverData?.MapObject;
            List <(float x, float y, float z, Color color, bool isHovered)> quad =
                new List <(float x, float y, float z, Color color, bool isHovered)>()
            {
                (xMin, posAngleY, zMin, Color, isHovered),
                (xMin, posAngleY, zMax, Color, isHovered),
                (xMax, posAngleY, zMax, Color, isHovered),
                (xMax, posAngleY, zMin, Color, isHovered),
            };

            return(new List <List <(float x, float y, float z, Color color, bool isHovered)> >()
            {
                quad
            });
        }
        protected override List <(float x, float y, float z)> GetVerticesTopDownView()
        {
            (double x1, double y1, double z1, double angle1) = _posAngle1.GetValues();
            (double x2, double y2, double z2, double angle2) = _posAngle2.GetValues();
            double dist = PositionAngle.GetHDistance(_posAngle1, _posAngle2);

            (double startX, double startZ) = MoreMath.ExtrapolateLine2D(x2, z2, x1, z1, dist + _backwardsSize);
            (double endX, double endZ)     = MoreMath.ExtrapolateLine2D(x1, z1, x2, z2, (_useFixedSize ? 0 : dist) + Size);

            List <(float x, float y, float z)> vertices = new List <(float x, float y, float z)>();

            vertices.Add(((float)startX, 0, (float)startZ));
            vertices.Add(((float)endX, 0, (float)endZ));
            return(vertices);
        }
        protected override List <List <(float x, float y, float z, Color color, bool isHovered)> > GetQuadList(MapObjectHoverData hoverData)
        {
            (float posAngleX, float posAngleY, float posAngleZ, float posAngleAngle) =
                ((float, float, float, float))_posAngle.GetValues();

            (int cellX, int cellZ) = CellUtilities.GetCell(posAngleX, posAngleZ);
            int xMin = (cellX - 8) * 1024;
            int xMax = xMin + 1024;
            int zMin = (cellZ - 8) * 1024;
            int zMax = zMin + 1024;

            bool isHovered = this == hoverData?.MapObject;

            List <(float x, float y, float z, Color color, bool isHovered)> quad =
                new List <(float x, float y, float z, Color color, bool isHovered)>()
            {
                (xMin, posAngleY, zMin, Color, isHovered),
                (xMin, posAngleY, zMax, Color, isHovered),
                (xMax, posAngleY, zMax, Color, isHovered),
                (xMax, posAngleY, zMin, Color, isHovered),
            };

            return(new List <List <(float x, float y, float z, Color color, bool isHovered)> >()
            {
                quad
            });
        }
        protected override List <(float x, float y, float z)> GetVerticesTopDownView()
        {
            List <(float x, float y, float z)> vertices = new List <(float x, float y, float z)>();

            (double x1, double y1, double z1, double a) = _posAngle.GetValues();
            int startingAngle = _useRelativeAngles ? MoreMath.NormalizeAngleTruncated(a) : 0;

            void addPointUsingAngle(int angle)
            {
                (double x2, double z2) = MoreMath.AddVectorToPoint(Size, angle, x1, z1);
                vertices.Add(((float)x1, (float)y1, (float)z1));
                vertices.Add(((float)x2, (float)y1, (float)z2));
            }

            if (_useInGameAngles)
            {
                foreach (int angle in InGameTrigUtilities.GetInGameAngles())
                {
                    addPointUsingAngle(MoreMath.NormalizeAngleTruncated(angle));
                }
            }
            else
            {
                for (int angle = startingAngle; angle < startingAngle + 65536; angle += _angleDiff)
                {
                    addPointUsingAngle(angle);
                }
            }
            return(vertices);
        }
Exemple #5
0
        protected override List <(float x, float y, float z)> GetVerticesTopDownView()
        {
            (double x, double y, double z, double angle) = _posAngle.GetValues();
            (double frontCenterX, double frontCenterZ)   = MoreMath.AddVectorToPoint(150, angle, x, z);
            (double backCenterX, double backCenterZ)     = MoreMath.AddVectorToPoint(-450, angle, x, z);
            (double frontLeftX, double frontLeftZ)       = MoreMath.AddVectorToPoint(140, angle + 16384, frontCenterX, frontCenterZ);
            (double frontRightX, double frontRightZ)     = MoreMath.AddVectorToPoint(140, angle - 16384, frontCenterX, frontCenterZ);
            (double backLeftX, double backLeftZ)         = MoreMath.AddVectorToPoint(140, angle + 16384, backCenterX, backCenterZ);
            (double backRightX, double backRightZ)       = MoreMath.AddVectorToPoint(140, angle - 16384, backCenterX, backCenterZ);

            List <(float x, float y, float z)> vertices = new List <(float x, float y, float z)>();

            vertices.Add(((float)frontLeftX, (float)y, (float)frontLeftZ));
            vertices.Add(((float)frontRightX, (float)y, (float)frontRightZ));

            vertices.Add(((float)frontRightX, (float)y, (float)frontRightZ));
            vertices.Add(((float)backRightX, (float)y, (float)backRightZ));

            vertices.Add(((float)backRightX, (float)y, (float)backRightZ));
            vertices.Add(((float)backLeftX, (float)y, (float)backLeftZ));

            vertices.Add(((float)backLeftX, (float)y, (float)backLeftZ));
            vertices.Add(((float)frontLeftX, (float)y, (float)frontLeftZ));

            return(vertices);
        }
Exemple #6
0
 protected List <(float centerX, float centerZ, float radius, float angle, float angleRadius)> GetDimensions()
 {
     (double x, double y, double z, double angle) = _posAngle.GetValues();
     return(new List <(float centerX, float centerZ, float radius, float angle, float angleRadius)>()
     {
         ((float)x, (float)z, Size, (float)angle, _angleRadius)
     });
 }
        protected override List <Vector3> GetVertices(MapGraphics graphics)
        {
            (double x1, double y1, double z1, double angle1) = _posAngle1.GetValues();
            (double x2, double y2, double z2, double angle2) = _posAngle2.GetValues();
            double dist = PositionAngle.GetHDistance(_posAngle1, _posAngle2);

            (double startX, double startZ) = MoreMath.ExtrapolateLine2D(x2, z2, x1, z1, dist + _backwardsSize);
            (double endX, double endZ)     = MoreMath.ExtrapolateLine2D(x1, z1, x2, z2, (_useFixedSize ? 0 : dist) + Size);

            var vertices = new List <Vector3>();

            vertices.Add(new Vector3((float)startX, 0, (float)startZ));
            vertices.Add(new Vector3((float)endX, 0, (float)endZ));
            return(vertices);
        }
        protected override List <(float x, float y, float z)> GetVerticesTopDownView()
        {
            (float x, float y, float z, float angle) = ((float, float, float, float))_posAngle.GetValues();

            (float x1, float z1) =
                ((float, float))MoreMath.AddVectorToPoint(Size, angle - 16384, x, z);
            (float x2, float z2) =
                ((float, float))MoreMath.AddVectorToPoint(Size, angle + 16384, x, z);

            return(new List <(float x, float y, float z)>()
            {
                (x1, y, z1),
                (x2, y, z2),
            });
        }