Exemplo n.º 1
0
        private void RenderGridCellLines_Obsolete(XZGrid grid, XZVisibleGridCellRange visibleCellRange)
        {
            int   minCellIndexX    = visibleCellRange.XAxisVisibleCellRange.Min;
            int   maxCellIndexX    = visibleCellRange.XAxisVisibleCellRange.Max;
            float numberOfCellsOnX = maxCellIndexX - minCellIndexX + 1.0f;

            int   minCellIndexZ    = visibleCellRange.ZAxisVisibleCellRange.Min;
            int   maxCellIndexZ    = visibleCellRange.ZAxisVisibleCellRange.Max;
            float numberOfCellsOnZ = maxCellIndexZ - minCellIndexZ + 1.0f;

            XZGridCellSizeSettings gridCellSizeSettings = grid.CellSizeSettings;
            XZGridRenderSettings   gridRenderSettings   = grid.RenderSettings;

            Vector3 startPointOnX, startPointOnZ;
            Vector3 lineCubeSize = Vector3.zero;

            // Render the grid lines which extend along the grid's X axis
            GizmosColor.Push(grid.RenderSettings.CellLineColor);
            startPointOnX  = grid.GetCellHrzStart(minCellIndexX);
            lineCubeSize.z = gridRenderSettings.CellLineThickness;
            int maxLineIndex = maxCellIndexZ + 1;

            for (int lineIndex = minCellIndexZ; lineIndex <= maxLineIndex; ++lineIndex)
            {
                startPointOnZ = grid.GetCellDepthStart(lineIndex);
                Vector3 firstPoint  = startPointOnX + startPointOnZ;
                Vector3 secondPoint = firstPoint + XZGrid.ModelSpaceRightAxis * (numberOfCellsOnX * gridCellSizeSettings.CellSizeX);

                lineCubeSize.x = (firstPoint - secondPoint).magnitude + gridRenderSettings.CellLineThickness;
                Gizmos.DrawCube((firstPoint + secondPoint) * 0.5f, lineCubeSize);
            }

            // Render the grid lines which extend along the grid's Z axis
            startPointOnZ  = grid.GetCellDepthStart(minCellIndexZ);
            lineCubeSize.x = gridRenderSettings.CellLineThickness;
            maxLineIndex   = maxCellIndexX + 1;
            for (int lineIndex = minCellIndexX; lineIndex <= maxLineIndex; ++lineIndex)
            {
                startPointOnX = grid.GetCellHrzStart(lineIndex);
                Vector3 firstPoint  = startPointOnX + startPointOnZ;
                Vector3 secondPoint = firstPoint + XZGrid.ModelSpaceLookAxis * (numberOfCellsOnZ * gridCellSizeSettings.CellSizeZ);

                lineCubeSize.z = (firstPoint - secondPoint).magnitude;
                Gizmos.DrawCube((firstPoint + secondPoint) * 0.5f, lineCubeSize);
            }
            GizmosColor.Pop();
        }
Exemplo n.º 2
0
        private void RenderGridPlane_Obsolete(XZGrid grid, XZVisibleGridCellRange visibleCellRange)
        {
            int minCellIndexX = visibleCellRange.XAxisVisibleCellRange.Min;
            int maxCellIndexX = visibleCellRange.XAxisVisibleCellRange.Max;

            int minCellIndexZ = visibleCellRange.ZAxisVisibleCellRange.Min;
            int maxCellIndexZ = visibleCellRange.ZAxisVisibleCellRange.Max;

            float numberOfCellsOnX = maxCellIndexX - minCellIndexX + 1.0f;
            float numberOfCellsOnZ = maxCellIndexZ - minCellIndexZ + 1.0f;

            XZGridCellSizeSettings gridCellSizeSettings = grid.CellSizeSettings;
            Vector3 planeCenter = (grid.GetCellHrzStart(minCellIndexX) + grid.GetCellDepthStart(minCellIndexZ) +
                                   grid.GetCellHrzStart(maxCellIndexX + 1) + grid.GetCellDepthStart(maxCellIndexZ + 1)) * 0.5f;
            Vector3 planeSize = new Vector3(numberOfCellsOnX * gridCellSizeSettings.CellSizeX, 0.0f, numberOfCellsOnZ * gridCellSizeSettings.CellSizeZ);

            GizmosColor.Push(grid.RenderSettings.PlaneColor);
            Gizmos.DrawCube(planeCenter, planeSize);
            GizmosColor.Pop();
        }
Exemplo n.º 3
0
 public XZGridCellSizeSettingsView(XZGridCellSizeSettings settings)
 {
     _settings = settings;
 }