public void GenerateObstacleInfo(CellManager cellMgr) { //标记所有格子为阻挡 for (int row = 0; row < cellMgr.GetMaxRow(); row++) { for (int col = 0; col < cellMgr.GetMaxCol(); col++) { cellMgr.SetCellStatus(row, col, BlockType.STATIC_BLOCK); } } //打开可行走区 foreach (TiledData data in walk_area_list_) { List <Vector3> pts = data.GetPoints(); MapDataUtil.MarkObstacleArea(pts, cellMgr, BlockType.NOT_BLOCK); } //标记阻挡区 foreach (TiledData data in obstacle_area_list_) { List <Vector3> pts = data.GetPoints(); MapDataUtil.MarkObstacleArea(pts, cellMgr, BlockType.STATIC_BLOCK); } //标记阻挡线 foreach (TiledData data in obstacle_line_list_) { List <Vector3> pts = data.GetPoints(); MarkObstacleLine(pts, cellMgr, BlockType.STATIC_BLOCK); } }
public void GenerateObstacleInfoWithNavmesh(CellManager cellMgr) { //标记所有格子为阻挡 for (int row = 0; row < cellMgr.GetMaxRow(); row++) { for (int col = 0; col < cellMgr.GetMaxCol(); col++) { cellMgr.SetCellStatus(row, col, BlockType.STATIC_BLOCK); } } //打开可行走区 foreach (TriangleNode node in navmesh_triangle_list) { List <Vector3> pts = new List <Vector3>(node.Points); MapDataUtil.MarkObstacleArea(pts, cellMgr, BlockType.NOT_BLOCK); } }