private TreasureRoomBuilder PromoteTreasureRoom(RoomBuilder roomBuilder) { var treasureRoom = new TreasureRoomBuilder(roomBuilder) .SetTreasure(new UnlockItem("Seismic Bomb", UnlockTypes.Weapon)); OnSpaceBuilderChanged.Raise(this); return(treasureRoom); }
public LaboratoryBuilder(ChunkBuilder chunkBuilder) : base(chunkBuilder) { _mainShafts = new List <ShaftBuilder>(); _corridorsByShaft = new Dictionary <ShaftBuilder, List <CorridorBuilder> >(); _secondaryShaftsByShaft = new Dictionary <ShaftBuilder, List <ShaftBuilder> >(); _connectionsByCorridor = new Dictionary <CorridorBuilder, RoomBuilder>(); _maximumCorridorSegments = Chance.Range(4, 8); var highestStory = Chance.Range(6, 10); var shaftPosition = new IntVector2(Chance.Range(_chunkBuilder.BottomLeftCorner.X, _chunkBuilder.TopRightCorner.X + 1), Chance.Range(_chunkBuilder.BottomLeftCorner.Y, _chunkBuilder.TopRightCorner.Y + 1)); RegisterNewMainShaft(AddShaft(0, highestStory, shaftPosition), highestStory); var randomConnectionWithRoom = _connectionsByCorridor.RandomItem(kvp => !(kvp.Value is null)); _treasureRoom = PromoteTreasureRoom(randomConnectionWithRoom.Value); _connectionsByCorridor[randomConnectionWithRoom.Key] = _treasureRoom; OnSpaceBuilderChanged.Raise(this); }