public void SetSquareUnwalkable(Point p) { if (p.x < 0 || p.y < 0 || p.x >= thisMap.Width || p.y >= thisMap.Height) { throw new ApplicationException("Point off template."); } thisMap.setCell(p.x, p.y, PathingTerrain.Unwalkable); }
private void BuildPathableMap() { thisMap = new PathingMap(template.Width, template.Height); for (int i = 0; i < template.Width; i++) { for (int j = 0; j < template.Height; j++) { thisMap.setCell(i, j, RoomTemplateTerrainWalkable.terrainWalkable[template.terrainMap[i, j]] ? PathingTerrain.Walkable : PathingTerrain.Unwalkable); } } }
private void BuildPathableMap() { pathFinding = new LibTCOD.TCODPathFindingWrapper(); pathingMap = new PathingMap(template.Width, template.Height); for (int i = 0; i < template.Width; i++) { for (int j = 0; j < template.Height; j++) { pathingMap.setCell(i, j, RoomTemplateTerrainWalkable.terrainWalkable[template.terrainMap[i, j]] ? PathingTerrain.Walkable : PathingTerrain.Unwalkable); } } pathFinding.updateMap(0, pathingMap); }
private bool ArePointsConnected(Point firstPoint, Point secondPoint) { //Build map representations PathingMap map = new PathingMap(Width, Height); for (int i = 0; i < Width; i++) { for (int j = 0; j < Height; j++) { map.setCell(i, j, baseMap.mapSquares[i, j].Walkable ? PathingTerrain.Walkable : PathingTerrain.Unwalkable); } } //Try to walk a path between the 2 staircases LibTCOD.TCODPathFindingWrapper pathFinder = new LibTCOD.TCODPathFindingWrapper(); pathFinder.updateMap(0, map); return(pathFinder.arePointsConnected(0, firstPoint, secondPoint, Pathing.PathingPermission.Normal)); }