/// <summary> /// Rasterize the obstacles into the grid. /// </summary> public void Rasterize() { // Clear the path grid from all blockages for (int i = 0; i < m_pathGrid.NumberOfCells; i++) { m_pathGrid.SetSolidity(i, false); } // Render all of the footprints into the path grid as blocked FootprintComponent[] footprintArray = (FootprintComponent[])GameObject.FindObjectsOfType(typeof(FootprintComponent)); foreach (FootprintComponent footprint in footprintArray) { int numObstructedCells = 0; int[] obstructedCells = footprint.m_static ? footprint.GetCachedObstructedCells(m_pathGrid, out numObstructedCells) : footprint.GetObstructedCells(m_pathGrid, out numObstructedCells); for (int i = 0; i < numObstructedCells; i++) { int obstructedCellIndex = obstructedCells[i]; if (m_pathGrid.IsInBounds(obstructedCellIndex)) { m_pathGrid.SetSolidity(obstructedCellIndex, true); } } } }