コード例 #1
0
ファイル: GridManager.cs プロジェクト: jamiesprax/ProTo
        private void PopulateAllCellsCache()
        {
            var cells = new List <Cell <T> >(gridCount.sqrMagnitude * cellCount.sqrMagnitude);

            for (int x = 0; x < gridCount.x; x++)
            {
                for (int y = 0; y < gridCount.y; y++)
                {
                    cells.AddRange(gridCells.GetCell(x, y).data.cellGrid.GetCells());
                }
            }
            cellCache = cells.ToArray();
            hash      = cellCache.GetHashCode();
        }
コード例 #2
0
ファイル: GridManager.cs プロジェクト: jamiesprax/ProTo
        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");
        }