private void Generate() { Assert.IsNotNull(_cellToTileTranslator); Assert.IsNotNull(_floorTilemap); Assert.IsNotNull(_templates); Assert.IsNotNull(_floorTile); Map = new Map.Builder() .WithSize(_mapSize.x, _mapSize.y) .WithRoomSize(_roomSize.x, _roomSize.y) .Build(); var generator = new MapGenerator(Map) { BranchProbability = _branchProbability, MinDensity = _minDensity }; foreach (var templateRoom in _templates.CreateRooms()) { generator.AddRoomTemplate(templateRoom); } generator.Generate(); Map = Map.GetCroppedClone() .GetCloneWithExtraBorderRooms(_borderInRooms) .CreateRemainingRoomsAndFillWithWalls(); Redraw(); }