Example #1
0
 protected void DrawSegments(VertexHelper vh, List <LineSegment> segments, GridLineConfig config)
 {
     segments.ForEach(segment => {
         vh.AddUIVertexQuad(CreateUIVertices(
                                segment.CreateSegmentVertices(),
                                CreateDefaultUVs(),
                                config.Color
                                ));
     });
 }
Example #2
0
        protected List <LineSegment> CreateLineSegments(float startingPoint,
                                                        GridLineConfig config,
                                                        float totalLenght,
                                                        bool vertical)
        {
            float segmentLenght  = config.ShouldDrawDashedLines() ? config.DashLenght : totalLenght;
            float segmentSpacing = config.ShouldDrawDashedLines() ? config.DashSpacing : 0;
            float a = startingPoint;
            float b = 0f;
            List <LineSegment> result = new List <LineSegment> ();

            while (b < totalLenght)
            {
                float   currentSegmentLenght = calculateSegmentLength(b, segmentLenght, segmentSpacing, totalLenght);
                Vector2 startingVector       = new Vector2(vertical? a : b, vertical? b : a);
                result.Add(CreateLine(startingVector, config.Thickness, currentSegmentLenght, vertical));
                b += currentSegmentLenght + segmentSpacing;
            }

            return(result);
        }
Example #3
0
 protected List <LineSegment> CreateVerticalOrHorizontalSegments(int linesCount, GridLineConfig config, float width, float height, bool vertical)
 {
     return(CreateSplitLinePoints(linesCount, height)
            .SelectMany(point => CreateLineSegments(point, config, width, vertical)).ToList());
 }