public TileNode(Room pRoom, int pX, int pY, TileType pType) { localPosition = new IntPoint(pX, pY); room = pRoom; isStartNode = false; isGoalNode = false; visited = false; distanceToGoal = 0f; pathCostHere = 0f; baseCost = 1f; type = pType; }
public Door(Room pRoom, string pName, IntPoint pPosition) : base(pRoom, pPosition.x, pPosition.y, TileType.DOOR) { name = pName; }
public void Clear() { _rooms.Clear(); yValue = 0; currentRoom = null; }
internal void BeginNewRoom(string p) { if (currentRoom != null) { _rooms.Add(currentRoom); } currentRoom = new Room(p); roomHasBeenMoved = false; yValue = 0; }
private static void PrintWorld(Room[] rooms, Path<TileNode> pPath) { StringBuilder sb = new StringBuilder(); for (int y = -1; y < 20; y++) { sb.Append(y.ToString()[y.ToString().Length - 1]); for (int x = -10; x < 20; x++) { char result = ' '; foreach (TileNode t in pPath.nodes) { if (t.worldPosition.x == x && t.worldPosition.y == y) { result = 'o'; } } if (result == ' ') { if (y == -1 && x > -10) { result = x.ToString()[x.ToString().Length - 1]; } else { foreach (Room r in rooms) { GameTypes.IntPoint point = r.WorldToLocalPoint(new GameTypes.IntPoint(x, y)); if (r.GetTileType(point.x, point.y) == TileType.WALL) { result = 'x'; } else if (r.GetTileType(point.x, point.y) == TileType.DOOR) { string matches = Regex.Replace((r.GetTile(point.x, point.y) as Door).name, "[A-z]", ""); result = matches[0]; } } } } sb.Append(result); } sb.Append("\r\n"); } Console.Write(sb.ToString()); }