public void createMap(csMapbuilder builder, int w, int h) { //while (true) { if (builder.Build_OneStartRoom()) { //break; } //} this.mapData.map = new List <AbstractEntity> [w, h]; for (int y = 0; y < this.mapData.getHeight(); y++) { for (int x = 0; x < this.mapData.getWidth(); x++) { this.mapData.map[x, y] = new List <AbstractEntity>(); if (builder.map[x, y] == 1) { this.entityFactory.CreateWallMapSquare(x, y, RLColor.Cyan); } else if (builder.map[x, y] == 2) { this.entityFactory.CreateDoorMapSquare(x, y, RLColor.Yellow); } else { this.entityFactory.CreateFloorMapSquare(x, y); } } } }
private void CopyMap(csMapbuilder b) { for (int x = 0; x < GameConstants.MapWidth; x++) { for (int y = 0; y < GameConstants.MapHeight; y++) { TileTypes type = ( TileTypes )b.GetCell(x, y); SetTile(new Point(x, y), type); } } }
public DungeonMap( ) { //map = RogueSharp.Map.Create( mapCreationStrategy ); features = new Dictionary <Point, TileFeature>(); actors = new Dictionary <Actor, Point>(); csMapbuilder b = new csMapbuilder(GameConstants.MapWidth, GameConstants.MapHeight); b.Build_OneStartRoom(); Rooms = b.GetRooms(); map = new Map(GameConstants.MapWidth, GameConstants.MapHeight); CopyMap(b); AddPlayer(); }
void buildDefaultMap() { csMapbuilder b = new csMapbuilder(mapRect.Width, mapRect.Height); b.Build_OneStartRoom(); for (int x = 0; x < mapRect.Width; x++) { for (int y = 0; y < mapRect.Height; y++) { TileType type = ( TileType )b.GetCell(x, y); SetTile(new Point(x, y), type); } } rooms = b.GetRooms(); }
protected override void CreateData() { this.entityFactory = new AlienEntityFactory(this, this.ecs, this.mapData); int mapWidth = 75; int mapHeight = 65; csMapbuilder builder = new csMapbuilder(mapWidth, mapHeight, 10, new Size(7, 7), new Size(11, 11), 2, 5); this.CreateMap(builder, mapWidth, mapHeight); // Create crew Point p = this.GetRandomSq(); this.currentUnit = this.entityFactory.CreatePlayersUnit('B', "Bret", 1, p.X, p.Y, 100); p = this.GetRandomSq(); this.entityFactory.CreatePlayersUnit('A', "Ash", 1, p.X, p.Y, 100); p = this.GetRandomSq(); this.entityFactory.CreatePlayersUnit('K', "Kane", 1, p.X, p.Y, 100); p = this.GetRandomSq(); this.entityFactory.CreatePlayersUnit('L', "Lambert", 1, p.X, p.Y, 100); p = this.GetRandomSq(); this.entityFactory.CreatePlayersUnit('D', "Dallas", 1, p.X, p.Y, 100); p = this.GetRandomSq(); this.entityFactory.CreatePlayersUnit('R', "Ripley", 1, p.X, p.Y, 100); p = this.GetRandomSq(); this.entityFactory.CreatePlayersUnit('P', "Parker", 1, p.X, p.Y, 100); //var gun = this.entityFactory.CreateGunItem(); //this.entityFactory.AddEntityToUnit(gun, this.currentUnit); // Add weapons and equipment var gun2 = this.entityFactory.CreateGunItem(); p = this.GetRandomSq(); this.entityFactory.AddEntityToMap(gun2, p.X, p.Y); // Jones p = this.GetRandomSq(); this.entityFactory.CreateJones(p.X, p.Y); // Alien p = this.GetRandomSq(); AlienEntityFactory.CreateAlien(this.ecs, this.mapData, p.X, p.Y); }
public void CreateMap(csMapbuilder builder, int w, int h) { //csMapbuilder builder = null; //while (true) { //builder = new csMapbuilder(w, h); if (builder.Build_OneStartRoom()) { //break; } //} this.mapData.map = new List <AbstractEntity> [w, h]; for (int y = 0; y < this.mapData.getHeight(); y++) { for (int x = 0; x < this.mapData.getWidth(); x++) { this.mapData.map[x, y] = new List <AbstractEntity>(); if (builder.map[x, y] == 1) { this.entityFactory.CreateWallMapSquare(x, y, RLColor.Green); } else if (builder.map[x, y] == 2) { this.entityFactory.CreateDoorMapSquare(x, y, RLColor.Brown); } else { this.entityFactory.CreateFloorMapSquare(x, y); } } } Point p = this.GetRandomSq(); this.entityFactory.CreateSelfDestructConsole(p.X, p.Y); }
protected override void CreateData() { this.entityFactory = new ShadowfireEntityFactory(this, this.ecs, this.mapData); int mapWidth = 75; int mapHeight = 65; csMapbuilder builder = new csMapbuilder(mapWidth, mapHeight, 16, new Size(5, 5), new Size(15, 15), 3, 5); this.createMap(builder, mapWidth, mapHeight); int unitStartX = mapWidth / 2; int unitStartY = mapHeight / 2; this.currentUnit = this.entityFactory.CreatePlayersUnit('S', "Syylk", 1, unitStartX, unitStartY, 100); var gun = this.entityFactory.CreateGunItem(); this.entityFactory.AddEntityToUnit(gun, this.currentUnit); this.entityFactory.CreatePlayersUnit('M', "Manto", 2, unitStartX + 1, unitStartY + 1, 100); var gun2 = this.entityFactory.CreateGunItem(); this.entityFactory.AddEntityToMap(gun2, unitStartX, unitStartY + 1); var grenade = this.entityFactory.CreateGrenadeItem(); this.entityFactory.AddEntityToMap(grenade, unitStartX + 3, unitStartY + 1); for (int i = 1; i < builder.rctBuiltRooms.Count; i++) { Rectangle r = builder.rctBuiltRooms[i]; this.entityFactory.createEnemyUnit($"Enemy {i}", r.X, r.Y, 90); } }