public MapGenerator(IRMap map, IMobPackManager mobPackManager) { _map = map; _mobPackManager = mobPackManager; _rows = map.Rows; _cols = map.Columns; _directions = RHelper.GetDirections(); _oppositeDirections = new Dictionary <Direction, Direction> { { Direction.North, Direction.South }, { Direction.East, Direction.West }, { Direction.South, Direction.North }, { Direction.West, Direction.East }, { Direction.Center, Direction.Center } }; var roomGen = new RoomGenerator(5, 5, 10, 10, _map); var corridorGen = new HallwayGenerator(20, 20, 50, 50, _map); var drunkDrigger = new DrunkDigger(50, 50, 100, 100, _map); var treasureRoomGen = new TreasureRoom(5, 5, 13, 13, _map); _generators = new RandomContainer <IGenerator> { { roomGen, 60 }, { corridorGen, 5 }, { drunkDrigger, 180 }, { treasureRoomGen, 2 } }; roomGen.EnableEnemySpawning(_mobPackManager, 15); drunkDrigger.EnableEnemySpawning(_mobPackManager, 20); }
private DungeonRoom CreateRandomExit(PlanetData data, DungeonRoom room, bool locked, int lockID, bool bossRoom, bool treasure, PlanetDifficultyModifiers difficultyModifiers) { if (room.ExitCount == 4) { return(room); } List <Direction> directions = new List <Direction> { Direction.Up, Direction.Right, Direction.Down, Direction.Left }; //remove any directions that are not available for (int j = directions.Count - 1; j >= 0; j--) { IntPair roomPos = AddDirection(room.position, directions[j]); if (data.GetRoomAtPosition(roomPos) != null) { directions.RemoveAt(j); } } //if no available directions then we're in a dead end if (directions.Count == 0) { return(room); } Direction randomDirection = directions[Random.Range(0, directions.Count)]; IntPair pos = AddDirection(room.position, randomDirection); DungeonRoom newRoom; if (bossRoom) { newRoom = new BossRoom(pos, room, difficultyModifiers.enemyRoomDifficulty); } else if (treasure) { newRoom = new TreasureRoom(pos, room); } else { newRoom = PickRandomRoom(pos, room, difficultyModifiers); } data.AddRoom(newRoom); if (locked) { ConnectWithLock(room, newRoom, randomDirection, lockID); } else { Connect(room, newRoom, randomDirection); } return(newRoom); }
public SerializableTreasureRoom(TreasureRoom treasureRoom) : base(treasureRoom) { _bottomLeftCorner = treasureRoom.BottomLeftCorner; _topRightCorner = treasureRoom.TopRightCorner; _treasure = treasureRoom.Treasure; }