public static IMap CreateMap(World world) { BigRoom _map = new BigRoom(); _map.CreateBigRoom(world); return(_map); }
public static Level GenerateBigRoomTest(Game game) { Level newLvl = new Level(game); var _room = new BigRoom(game, new Vector2(0, 0) , new Color(MyRandom.Random.Next(0, 255), MyRandom.Random.Next(0, 255), MyRandom.Random.Next(0, 255)) , new Color(MyRandom.Random.Next(0, 255), MyRandom.Random.Next(0, 255), MyRandom.Random.Next(0, 255)) ,new Vector2(2,3) ); _room.DoorPositions.PositionsArray[0, 0] = new DoorPosition(); _room.DoorPositions.PositionsArray[0, 0].left = 20; _room.DoorPositions.PositionsArray[0, 1] = new DoorPosition(); _room.DoorPositions.PositionsArray[0, 1].left = 20; _room.DoorPositions.PositionsArray[1, 0] = new DoorPosition(); _room.DoorPositions.PositionsArray[1, 0].top = 12; _room.DoorPositions.PositionsArray[0, 2] = new DoorPosition(); _room.DoorPositions.PositionsArray[1, 2] = new DoorPosition(); _room.DoorPositions.PositionsArray[1, 2].bottom = 5; _room.DoorPositions.PositionsArray[1, 2].right = 20; newLvl.Roomlist.Add(_room); newLvl.StartRoom = _room; var _sroom = new SmallRoom(game, new Vector2(-1, 0) , new Color(MyRandom.Random.Next(0, 255), MyRandom.Random.Next(0, 255), MyRandom.Random.Next(0, 255)) , new Color(MyRandom.Random.Next(0, 255), MyRandom.Random.Next(0, 255), MyRandom.Random.Next(0, 255)) ); _sroom.DoorPositions.PositionsArray[0, 0] = new DoorPosition(); _sroom.DoorPositions.PositionsArray[0, 0].right = 1; _sroom.DoorPositions.PositionsArray[0, 0].bottom = 28; _sroom.DoorPositions.PositionsArray[0, 0].top = 1; _sroom.DoorPositions.PositionsArray[0, 0].left = 20; newLvl.Roomlist.Add(_sroom); var _sroom1 = new SmallRoom(game, new Vector2(-1, 1) , new Color(MyRandom.Random.Next(0, 255), MyRandom.Random.Next(0, 255), MyRandom.Random.Next(0, 255)) , new Color(MyRandom.Random.Next(0, 255), MyRandom.Random.Next(0, 255), MyRandom.Random.Next(0, 255)) ); _sroom1.DoorPositions.PositionsArray[0, 0] = new DoorPosition(); _sroom1.DoorPositions.PositionsArray[0, 0].right = 12; _sroom1.DoorPositions.PositionsArray[0, 0].bottom = 28; _sroom1.DoorPositions.PositionsArray[0, 0].top = 28; _sroom1.DoorPositions.PositionsArray[0, 0].left = 20; newLvl.Roomlist.Add(_sroom1); return newLvl; }
public Cave(Game _game, BigRoom room) { CaveGenerator cavegen = new CaveGenerator(); _solidGrid = cavegen.GenerateCave(room._size, room.DoorPositions); var CaveBlockArray = new CaveBlock[_solidGrid.GetLength(0), _solidGrid.GetLength(1)]; for (int x = 1; x < _solidGrid.GetLength(0) - 1; x++) { for (int y = 1; y < _solidGrid.GetLength(1) - 1; y++) { if (_solidGrid[x, y] == true) { room.RoomOccupiedGrid[x - 1, y - 1] = true; bool solid = false; foreach (var coord in Globals.GetVonNeumann(new Coord(x,y))) { if (_solidGrid[coord.X, coord.Y] == false) solid = true; } if (solid == true) { CaveBlockArray[x, y] = new CaveBlock(_game, new Vector2(room.Position.X + (x * Globals.SmallGridSize.X), room.Position.Y + (y * Globals.SmallGridSize.Y)), room.RoomAmbient.RoomColour , MaterialsStats.Rock01, true,room.RoomAmbient.RoomTileset,room.RoomAmbient.GlowColour); } else { CaveBlockArray[x, y] = new CaveBlock(_game, new Vector2(room.Position.X + (x * Globals.SmallGridSize.X), room.Position.Y + (y * Globals.SmallGridSize.Y)), room.RoomAmbient.RoomColour , MaterialsStats.Rock01, false, room.RoomAmbient.RoomTileset, room.RoomAmbient.GlowColour); } DestructibleWalls.Add(CaveBlockArray[x, y]); } } } for (int x = 1; x < CaveBlockArray.GetLength(0) - 1; x++) { for (int y = 1; y < CaveBlockArray.GetLength(1) - 1; y++) { if (CaveBlockArray[x, y] != null) { foreach (var coord in Globals.GetVonNeumann(new Coord(x,y))) { if (CaveBlockArray[coord.X, coord.Y] != null) { CaveBlockArray[x, y].AddNeighbour(CaveBlockArray[coord.X, coord.Y]); } } } } } }
public static Interior NewInterior(InteriorNames interiorname, Game _game, BigRoom room) { switch (interiorname) { case InteriorNames.Empty: return new Interior(); case InteriorNames.Cave: return new Cave(_game,room); case InteriorNames.Hulk: return new Hulk(_game, room.Position, room._size, room.RoomAmbient); } return new Interior(); }
private void generateMainRooms() { int gencount = 0; for (int x = 0; x < _size; x += _xgrid) { for (int y = 0; y < _size; y += _ygrid) { //HACK made roomchance always true int isroom = MyRandom.Random.Next(2, _roomchance); if (isroom == 1) { continue; } else { int xsize = MyRandom.Random.Next(1, _xgrid); int ysize = MyRandom.Random.Next(1, _ygrid); int xpos = MyRandom.Random.Next(0, _xgrid- xsize); int ypos = MyRandom.Random.Next(0, _ygrid - ysize); var rogueroom = _rogueroomlist[new Tuple<int, int>(x / _xgrid, y / _ygrid)] = new RogueRoom(x / _xgrid, y / _ygrid,x+xpos,y+ypos,_xdiv,_ydiv,xsize,ysize,false); /* if (xsize == 1 && ysize == 1) { var _room = new SmallRoom(_game, new Vector2(x+xpos, y+ypos) , RandomColour.NewColour() , RandomColour.NewColour() ); _occupiedGrid[x + xpos, y + ypos] = true; _newLvl.Roomlist.Add(_room); rogueroom.RoomField = _room; } else {*/ var roomcolours = RandomColour.RoomColours(); var _room = new BigRoom(_game, new Vector2(x + xpos, y + ypos) , roomcolours[0] , roomcolours[1] , new Vector2(xsize, ysize)); for (int x1 = x+xpos; x1 < x+xpos+xsize ; x1++) { for (int y1 = y+ypos; y1 < y+ypos+ysize; y1++) { _occupiedGrid[x1,y1] = true; } } //} //adddoors(_room); _newLvl.Roomlist.Add(_room); rogueroom.RoomField = _room; gencount++; } } } }