Class in ChivalrousGames.DungeonMaster / Inherits from: MonoBehaviour
Description
This is the main element in the Dungeon Master asset. It ties everything together. It is the starting point to generate the game. A Dungeon is made up of Levels. Levels are made up of Rooms. Rooms connect toward other Rooms, Levels and outside of the Dungeon via RoomConnectors, LevelConnectors and DungeonConnectors. Rooms are populated with Spawnables.
FULL version only The script responsible to calculate journeys on the map (sort of a GPS feature). Can be re sub-classed if another behavior is desired (DefaultJourneyCalculator is using a custom A* implementation). Added automatically on the Dungeon if the Dungeon Creation wizard is used.
FULL version only The script responsible to render journeys on the map (sort of a GPS feature). Can be re sub-classed if another behavior is desired (using Unity’s LineRenderer by default which isn’t great). Added automatically on the Dungeon if the Dungeon Creation wizard is used.
FULL version onlyReadOnly Gets the lowest coordinate of a Level in this Dungeon. This coordinate doesn’t need to have a Level assigned to it. ie: if a dungeon has two levels at coordinates: (0,1,0) and (1,0,0) the lowest level is (0,0,0)
FULL version onlyReadOnly Gets the highest coordinate of a Level in this Dungeon. This coordinate doesn’t need to have a Level assigned to it. ie: if a dungeon has two levels at coordinates: (0,1,0) and (1,0,0) the highest coordinate is (1,1,0)
Generated
bool
ReadOnly Indicates whether this Dungeon is generated.
ReadOnly Gets the rooms with filled dungeon connectors. A filled DungeonConnector is a dungeon connector that was spawned during dungeon generation. Will return null if Dungeon is not Generated.
public Dungeon dungeon;
void Start() {
if (!dungeon.Generated) {
dungeon.GenerateDungeon ();
if(!dungeon.Generated) {
Debug.LogError ("Dungeon was not generated successfully.", dungeon);
return;
}
}
}
ResetDungeonGeneration
public void ResetDungeonGeneration(bool deleteReport);
Parameters
deleteReport
bool
If true, will delete the dungeon generation report as well. For more information about the dungeon generation report, see DungeonGenerationConfig.
Description
Resets the dungeon generation. It is automatically called by GenerateDungeon also. This method is used to cleanup everything in the Dungeon and start over fresh.
RenderAll
public void RenderAll();
Description
Renders all levels. This should mostly be used for tests since rendering all levels at once will most likely be too heavy. Use a DungeonRenderer to manage rendering in your game.
UnrenderAll
public void UnrenderAll();
Description
Unrenders everything, should only be used as a rollback from RenderAll during tests.
UnrenderAllDetachedSpawnables
public void UnrenderAllDetachedSpawnables();
Description
Unrenders all detached spawnables of the Dungeon. For more information on Detached Spawnable, please see Spawnable.
IsPositionWithinDungeon
public bool IsPositionWithinDungeon(Vector3 worldPosition);
True if worldPosition is located within a dungeon Room; otherwise, false.
Description
Verifies if a world position is located within the bounding box of a Dungeon Room. It will not verify the depth of walls and such, only the bounding box.
GetRoomByPosition
public Room GetRoomByPosition(Vector3 worldPosition);