public void UpdateGraph(ICellMap map, ICellFragment cellFragment, HierarchicalMap graph, NeighbourMode neighbourMode) { var clusterMatrix = graph.ZeroLevelClusters; int clusterWidth = graph.ClusterDefaultWidth; int clusterHeight = graph.ClusterDefaultHeight; Vector2Int fragmentSize = new Vector2Int(cellFragment.Width, cellFragment.Height); Vector2Int leftBottomClusterPosition = GetContainingClusterPosition(clusterMatrix, clusterWidth, clusterHeight, cellFragment.LeftBottom); Vector2Int rightTopClusterPosition = GetContainingClusterPosition(clusterMatrix, clusterWidth, clusterHeight, cellFragment.LeftBottom + fragmentSize); int iMin = leftBottomClusterPosition.X; int iMax = rightTopClusterPosition.X; int jMin = leftBottomClusterPosition.Y; int jMax = rightTopClusterPosition.Y; for (int i = iMin; i <= iMax; i++) { for (int j = jMin; j <= jMax; j++) { CellCluster currentCluster = clusterMatrix[i, j]; int prevI = i - 1; int prevJ = j - 1; int nextJ = j + 1; if (prevI >= iMin) { CellCluster neighbourCluster = clusterMatrix[prevI, j]; RemoveTransitionNodes(currentCluster, neighbourCluster, graph); ProceedNeighbourClusters(currentCluster, neighbourCluster, graph); } if (prevJ >= jMin) { CellCluster neighbourCluster = clusterMatrix[i, prevJ]; RemoveTransitionNodes(currentCluster, neighbourCluster, graph); ProceedNeighbourClusters(currentCluster, neighbourCluster, graph); } } } for (int i = iMin; i <= iMax; i++) { for (int j = jMin; j <= jMax; j++) { CellCluster currentCluster = clusterMatrix[i, j]; currentCluster.CalculatePaths(neighbourMode, null); } } }
public void AddObstacle(ICellFragment cellCluster) { _layeredCellMap.AddFragment(cellCluster); }
public void AddFragment(ICellFragment fragment) { _layers.Add(fragment); _layerOffsets.Add(fragment.LeftBottom); }
public void AddObstacle(ICellFragment cellCluster) { throw new NotImplementedException(); }
public void AddObstacle(ICellFragment cellCluster) { _userObstacles.Add(cellCluster); }