public int WorldSize; // The size of the world /// <summary> /// Creates a world with a given size. /// </summary> /// <param name="size">The size of the world.</param> /// <param name="startX">The starting position for the player in axis X.</param> /// <param name="startY">The starting position for the player in axis Y.</param> public World(int size, int startX, int startY) { Textures = new TextureManager(); Tiles = new TileRenderer(); WorldSize = size; WorldMap = new Room[size][]; for (int i = 0; i < size; i++) { WorldMap[i] = new Room[size]; } //TODO create a special Room class for the starting room WorldMap[startX][startY] = new Room(startX, startY, Textures, Tiles, 0); CurrentXPosition = startX; CurrentYPosition = startY; currentRoom = WorldMap[startX][startY]; }
public int RoomType; // Which type of room /// <summary> /// Creates an empty room. The room will be filled/generated when /// the player enters it for the first time. /// </summary> /// <param name="xPosition">The world position of the room.</param> /// <param name="yPosition">The world position of the room.</param> /// <param name="tm">The TextureManager </param> /// <param name="tr">The TileRenderer draws the tile sprites.</param> public Room(int xPosition, int yPosition, TextureManager tm, TileRenderer tr, int roomType) { Entitys = new List <Entity>(); Monsters = new List <Monster>(); Textures = tm; Tiles = tr; RoomType = roomType; RngGenerator = new Random(); XPosition = xPosition; YPosition = yPosition; Map = new string[MapSizeX][]; for (int x = 0; x < MapSizeX; x++) { Map[x] = new string[MapSizeY]; for (int y = 0; y < MapSizeY; y++) { Map[x][y] = null; } } }