Dungeon Generator
Last updated
Last updated
Presented by IDungeonGenerator
interface, this system allows to generate dungeons of needed size and complexity by maens of BSP algorithm.
To use it, you can just drag DungeonGenerator
prefab onto your game scene and set it up as you want.
Floor Tile Prefabs – list of floor tile prefabs. You can add your own tiles here, they should be gameobjects with width and length equal to 1 unit, height can have any value.
Wall Tile Prefabs – list of wall tile prefabs. You can add your own tiles here, they should be gameobjects with width and length equal to 1 unit, height can have any value.
Enable Walls – if set to true, walls will be generated, otherwise, dungeon will be only with floor tiles.
Dungeon Width – width of dungeon, 50 units by default.
Dungeon Length – length of dungeon, 50 units by default.
Min Room Size – minimal room size in units.
Max Iterations – max number of rooms splitting iterations.
Room Margin – margin between rooms in units.
Corridor Width – typical width of corridor in units.
You can also use its functionality via code. For this, inject IDungeonGenerator interface into your class.
This method generates dungeon with default settings set in DungeonGenerator inspector.
This method generates dungeon with default settings set in DungeonGenerator inspector, but with custom width and length.
This method generates dungeon with custom settings.
Example:
This method clears current dungeon. Automatically called when new dungeon is being generated.
This method generates NavMesh for current dungeon.