public Grid3 <int> CreateGrid()
        {
            Grid3 <int> grid = new Grid3 <int>();

            foreach (RectTool rectTool in rectTools)
            {
                switch (rectTool.toolType)
                {
                case RectTool.eToolType.add:
                    grid.AddCells(rectTool.toolBlockId, rectTool.toolStart, rectTool.toolSize);
                    break;

                case RectTool.eToolType.remove:
                    grid.RemoveCells(rectTool.toolStart, rectTool.toolSize);
                    break;

                case RectTool.eToolType.writeover:
                    grid.WriteoverCells(rectTool.toolBlockId, rectTool.toolStart, rectTool.toolSize);
                    break;

                case RectTool.eToolType.intersect:
                    grid.IntersectCells(rectTool.toolBlockId, rectTool.toolStart, rectTool.toolSize);
                    break;
                }
            }

            return(grid);
        }
Пример #2
0
        public void GenerateMiniblocks()
        {
            MiniblockRectangleTool miniblockRectangleTool = gameObject.GetComponent <MiniblockRectangleTool>();

            blockIdMap = (miniblockRectangleTool != null) ? miniblockRectangleTool.CreateGrid() : blockIdMap;

            GenerateMesh();
            return;
        }