public void setupAstar() { astar = new AStar(width, height); for(int yy = 0; yy < this.height; yy++) { for(int xx = 0; xx < this.width; xx++) { astar.setIsWalkable(xx,yy,this.bitMap[xx,yy] == 1); }//for }//for }
public void digOneHallway(GridNode[] hallway, Vector2 hallStart, Vector2 hallEnd, AStar anAstar = null) { bool exitMarked = false; bool entranceMarked = false; for(int i = 0; i < hallway.Length; i++) { GridNode pt = hallway[i]; if(bitMap[(int)pt.x,(int)pt.y] == 1 && !entranceMarked) { rooms_sorted[hallStart].exits.Add(new Vector2(hallway[i-1].x * tileWidth, hallway[i-1].y*tileHeight)); entranceMarked = true; }//if else if(!exitMarked && entranceMarked && bitMap[(int)pt.x,(int)pt.y] == 0) { rooms_sorted[hallEnd].exits.Add(new Vector2(pt.x * tileWidth, pt.y*tileHeight)); exitMarked = true; } bitMap[(int)pt.x,(int)pt.y] = 0; if(anAstar != null) { anAstar.setIsWalkable((int)pt.x, (int)pt.y, false); }//if }//for each }