Ejemplo n.º 1
0
        /// <inheritdoc />
        public override void Draw()
        {
            Color drawColor;

            int   lineCount = 0;
            float yPosTop   = 0;
            float yPosBot   = 0;

            float width  = BoundingBox.x + BoundingBox.width;
            float height = BoundingBox.y + BoundingBox.height;

            // Draw horizontal lines starting from (0, 0).
            while (yPosTop > BoundingBox.y || yPosBot <= height)
            {
                drawColor = lineCount % 10 == 0 ? SecondaryColor : MainColor;
                lineCount++;

                if (yPosTop > BoundingBox.y)
                {
                    EditorDrawingHelper.DrawHorizontalLine(new Vector3(BoundingBox.x, yPosTop), BoundingBox.width, drawColor);
                    yPosTop -= CellSize;
                }

                if (yPosBot <= height)
                {
                    EditorDrawingHelper.DrawHorizontalLine(new Vector3(BoundingBox.x, yPosBot), BoundingBox.width, drawColor);
                    yPosBot += CellSize;
                }
            }

            lineCount = 0;
            float xPosLeft  = 0;
            float xPosRight = 0;

            // Draw vertical lines starting from (0, 0).
            while (xPosLeft > BoundingBox.x || xPosRight <= width)
            {
                drawColor = lineCount % 10 == 0 ? SecondaryColor : MainColor;
                lineCount++;
                if (xPosLeft > BoundingBox.x)
                {
                    EditorDrawingHelper.DrawVerticalLine(new Vector3(xPosLeft, BoundingBox.y), BoundingBox.height, drawColor);
                    xPosLeft -= CellSize;
                }

                if (xPosRight <= width)
                {
                    EditorDrawingHelper.DrawVerticalLine(new Vector3(xPosRight, BoundingBox.y), BoundingBox.height, drawColor);
                    xPosRight += CellSize;
                }
            }
        }