Level
Class in ChivalrousGames.DungeonMaster / Inherits from: MonoBehaviour

Description

Usually represents a thematic area in a Dungeon. Levels are created by assembling Rooms.

Fields

generationConfigLevelGenerationConfigThe generation config for this Level.
mapConfigLevelMapConfigThe map configuration of this Level.
renderConfigLevelRenderConfigThe render config for this Level.
NOTE: It would be a good idea to call the DungeonRenderer.Render right away if the LevelRenderConfig of the current Level (or its properties) changes.

Properties

RoomsList<Room>ReadOnly
Gets the generated Rooms for this Level.
GeneratedboolReadOnly
Gets a value indicating whether this Level is generated.
DungeonDungeonReadOnly
Gets the Dungeon this Level belongs to.
MapGameObjectGameObjectReadOnly
Gets the map game object.
MapCharacterPositionGameObjectGameObjectReadOnly
Gets the map character position game object.
LowestCoordinatePointReadOnly
Gets the lowest coordinate of a Room in this Level. This coordinate doesn’t need to have a Room assigned to it. ie: if a Level has two Rooms at coordinates: (0,1,0) and (1,0,0) the lowest coordinate is (0,0,0).
HighestCoordinatePointReadOnly
Gets the highest coordinate of a Room in this Level. This coordinate doesn’t need to have a Room assigned to it. ie: if a level has two Rooms at coordinates: (0,1,0) and (1,0,0) the highest coordinate is (1,1,0).
LowestWorldPositionVector3ReadOnly
The lowest world position within this Level.
HighestWorldPositionVector3ReadOnly
The highest world position within this Level.
LowestFloorNumberintReadOnly
The lowest floor number, or -1 if level is not generated yet
HighestFloorNumberintReadOnly
The highest floor number, or -1 if level is not generated yet
LevelWidthfloatReadOnly
The width of the Level with its margin in real Unity units, or -1 if level is not generated yet (there is no level margin in Dungeon Master Lite)
LevelWidthNoMarginfloatFULL version onlyReadOnly
The width of the Level without its margin in real Unity units, or -1 if level is not generated yet
LevelHeightfloatReadOnly
The height of the Level with its margin in real Unity units, or -1 if level is not generated yet (there is no level margin in Dungeon Master Lite)
LevelHeightNoMarginfloatFULL version onlyReadOnly
The height of the Level without its margin, or -1 if level is not generated yet
LevelDepthfloatReadOnly
The depth of the Level with its margin in real Unity units, or -1 if level is not generated yet (there is no level margin in Dungeon Master Lite)
LevelDepthNoMarginfloatFULL version onlyReadOnly
The depth of the Level without its margin, or -1 if level is not generated yet
IsDiscoveredboolReadOnly
Gets a value indicating whether this Level was discovered. As soon as one Room in this Level is discovered or visited, the Level is discovered.
MapBehaviorLevelMapBehaviorFULL version onlyReadOnly
Gets the map behavior.
LevelGeneratorLevelGeneratorReadOnly
Gets the level generator.
GenerationRandomRandomReadOnly
Gets the generation random. This random is used to generate everything in the Level except for Spawnables.
SpawnRandomRandomReadOnly
Gets the spawn random. This random is used to generate Spawnables in the Level.

Methods

GenerateLevel
public bool GenerateLevel(int dungeonGenerationAttempt);
Parameters
dungeonGenerationAttemptintThe number of times the Level will try to generate itself before giving up at each Dungeon generation attempt.
Return
boolTrue if Level was generated successfully; otherwise, false.
Description
Generates the Level. Usually this is called by the Dungeon itself. There is no need to call this manually.
GetLevelLimitValueByDirection
public int GetLevelLimitValueByDirection(Direction direction);
Parameters
directionDirectionThe Direction for which the Level limit is requested. “None” Direction will throw an argument exception.
Return
intThe Level limit value in a specified Direction.
Description
Gets the Level limit value by Direction. Based on the max sizes defined in the LevelGenerationConfig. The Level limit is the max or min Room index.
FindRoomsWithFilledLevelConnectorsFULL version only
public List FindRoomsWithFilledLevelConnectors();
Return
List<Room>The rooms with filled LevelConnector.
Description
Finds the rooms with filled level connectors.
FindRoomsWithEmptyLevelConnectorsFULL version only
public List FindRoomsWithEmptyLevelConnectors();
Return
List<Room>The rooms with empty LevelConnector.
Description
Finds the rooms with empty level connectors.
FindRoomsWithFilledDungeonConnectors
public List FindRoomsWithFilledDungeonConnectors();
Return
List<Room>The rooms with filled DungeonConnector.
Description
Finds the rooms with filled dungeon connectors.
FindRoomsWithEmptyDungeonConnectors
public List FindRoomsWithEmptyDungeonConnectors();
Return
List<Room>The rooms with empty DungeonConnector.
Description
Finds the rooms with empty dungeon connectors.
FindRoomsWithFilledLevelPositionedConnectors
public List FindRoomsWithFilledLevelPositionedConnectors();
Return
List<Room>The rooms with filled LevelPositioned DungeonConnector.
Description
Finds the rooms with filled level positioned connectors. Both LevelConnector and DungeonConnector can be level positioned.
GetRoomsPerSpawnableType
public Dictionary> GetRoomsPerSpawnableType();
Return
Dictionary<SpawnableType, List<Room>>Gets all Rooms per SpawnableType.
Description
Gets all Rooms per SpawnableType. This is useful to know in which Rooms Spawnables with a certain SpawnableType were spawned.
GetFloorNumber
public int GetFloorNumber(Room room);
Parameters
roomRoomThe Room for which the floor number is requested.
Return
intThe floor number or -1 if can’t be determined.
Description
The floor number on which a specified Room is located.
GetFloorNumber
public int GetFloorNumber(Point coordinate);
Parameters
coordinatePointThe coordinate for which the floor number is requested.
Return
intThe floor number or -1 if can’t be determined.
Description
The floor number for a specified coordinate is located.
GetFloorGameObject
public GameObject GetFloorGameObject(int floorNumber);
Parameters
floorNumberintThe floor number for which the floor game object is requested.
Return
GameObjectThe floor game object if found; otherwise, null.
Description
Gets the floor game object. The floor game object is where room map game objects are found.
GetFloorGameObject
public GameObject GetFloorGameObject(Room room);
Parameters
roomRoomThe Room for which the floor game object is requested.
Return
GameObjectThe floor game object if found; otherwise, null.
Description
Gets the floor game object. The floor game object is where room map game objects are found.
GetFloorGameObject
public GameObject GetFloorGameObject(Point coordinate);
Parameters
coordinatePointThe coordinate for which the floor game object is requested.
Return
GameObjectThe floor game object if found; otherwise, null.
Description
Gets the floor game object. The floor game object is where room map game objects are found.
GetRoomByCoordinate
public Room GetRoomByCoordinate(Point coordinate);
Parameters
coordinatePointThe coordinate for which the Room is requested.
Return
RoomThe Room if found; otherwise, null.
Description
Get a Room by its coordinate in the Level.
GetRoomFromPresetRoomFULL version only
public Room GetRoomFromPresetRoom(PresetRoom presetRoom);
Parameters
presetRoomPresetRoomThe PresetRoom for which the corresponding generated Room is requested.
Return
RoomThe Room that was generated following the configurations of the specified PresetRoom.
Description
Gets the Room that was generated following the configurations of the specified PresetRoom. Works when the Level is generated.
GetPresetRoomFromRoomFULL version only
public PresetRoom GetPresetRoomFromRoom(Room room);
Parameters
roomRoomThe Room that was generated from the configuration of the requested PresetRoom.
Return
PresetRoomThe preset room if any, or null.
Description
Gets the PresetRoom a Room was created from if any. Will return null if Room was not created from a PresetRoom.
GetDiscoveredOrVisitedRooms
public List GetDiscoveredOrVisitedRooms();
Return
List<Room>The discovered or visited Rooms of this Level.
Description
Gets the Rooms that are either discovered or visited in this Level.
CountGeneratedSpawnableWithType
public int CountGeneratedSpawnableWithType(SpawnableType spawnableType);
Parameters
spawnableTypeSpawnableTypeThe SpawnableType with which generated Spawnable instances must be counted.
Return
intThe number of Spawnable generated in the Level with a specified SpawnableType.
Description
Counts number of Spawnables generated in the Level with a specified SpawnableType.
CountGeneratedSpawnable
public int CountGeneratedSpawnable(Spawnable spawnable);
Parameters
spawnableSpawnableThe Spawnable for which generated instances must be counted.
Return
intThe number of Spawnable generated in the Level.
Description
Counts number of a specified Spawnable instances generated in the Level.
IsCoordinateValid
public bool IsCoordinateValid(Point coordinate);
Parameters
coordinatePointThe coordinate to verify.
Return
trueTrue if coordinate is valid (within the bounds of the Level); otherwise, false.
Description
Determines if coordinate is valid within this Level (between 0 and level max value for all axis) according to the LevelGenerationConfig.
IsPositionWithinLevel
public bool IsPositionWithinLevel(Vector3 worldPosition);
Parameters
worldPositionVector3A world position (local position will not work)
Return
boolTrue if worldPosition is located within a Level Room; otherwise, false.
Description
Verifies if a world position is located within the bounding box of a Level Room. It will not verify the depth of walls and such, only the bounding box.
GetRoomByPosition
public Room GetRoomByPosition(Vector3 worldPosition);
Parameters
worldPositionVector3A world position (local position will not work)
Return
RoomThe Room that contains the worldPosition if any, or null if none.
Description
Gets the Room that contains the specified world position.