Exemplo n.º 1
0
        private void InitCellGrids()
        {
            gridCells = CellGrid <CellGridData <T> > .Create(gridCount.x, gridCount.y);

            for (int x = 0; x < gridCount.x; x++)
            {
                for (int y = 0; y < gridCount.y; y++)
                {
                    var gridCell = gridCells.GetCell(x, y);

                    var subGrid = CellGrid <T> .Create(cellCount.x, cellCount.y, gridCell);

                    var gridData = new CellGridData <T>()
                    {
                        cellGrid = subGrid,
                        cellGridWorldPosition = navWorldOrigin + new Vector3(x * gridSpacingX, 0, y * gridSpacingY)
                    };

                    gridCell.data = gridData;
                }
            }
            Debug.Log(gridCells.GetCells().Length + " grids created");
        }
Exemplo n.º 2
0
 public static Cell <T> Create(Vector2Int localCoord, CellGrid <T> parent)
 {
     return(new Cell <T>(localCoord, parent));
 }
Exemplo n.º 3
0
 private Cell(Vector2Int localCoord, CellGrid <T> parent)
 {
     this.localCoord = localCoord;
     this.grid       = parent;
 }