Room
Class in ChivalrousGames.DungeonMaster / Inherits from: MonoBehaviour

Description

Part of a Level in a Dungeon. It connects with other Rooms via Connectors and is populated with Spawnables.

Fields

generationConfigRoomGenerationConfigThe generation configuration for this Room.
mapConfigRoomMapConfigThe map configuration of this Room.
renderConfigRoomRenderConfigThe render configuration for this Room. Do not change this at runtime.
showGizmosboolRoom gizmos in the scene view of Unity Editor. Useless at runtime.

Properties

StatusRoomStatusGets or sets the room status.
CoordinatePointReadOnly
The coordinate of this Room in the Level.
RoomRotationPointRotationReadOnly
The rotation of this Room in the Level.
NeighborsNeighborsReadOnly
The Neighbors of this Room.
PrefabHolderGameObjectGameObjectReadOnly
The GameObject that will be the parent of the Room prefab.
RoomNavMeshManagerRoomNavMeshManagerReadOnly
Gets the RoomNavMeshManager component.
RoomTemplateRoomReadOnly
Gets the room template. (The room this instance is based on)
ConnectorPointsGameObjectGameObjectReadOnly
The GameObject that will be the parent of this Room’s ConnectorPoints.
SpawnPointsGameObjectGameObjectReadOnly
The GameObject that will be the parent of this Room’s SpawnPoints.
RoomTriggerGameObjectGameObjectReadOnly
The GameObject that will be the parent of the RoomTrigger.
CharacterPositionPrefabGOGameObjectReadOnly
Gets the character position prefab GameObject.
LevelLevelReadOnly
The Level this Room is a part of.
SpawnPointsList<SpawnPoint>ReadOnly
The SpawnPoints located in this Room.
BaseConnectorPointsList<BaseConnectorPoint>ReadOnly
Gets all the ConnectorPoints located in this Room.
RoomConnectorPointsList<RoomConnectorPoint>ReadOnly
Gets all the RoomConnectorPoints located in this Room.
LevelConnectorPointLevelConnectorPointFULL version onlyReadOnly
Get the LevelConnectorPoint located in this Room if any; otherwise, null.
DungeonConnectorPointDungeonConnectorPointReadOnly
Get the DungeonConnectorPoint located in this Room if any; otherwise, null.
HasLevelConnectorboolFULL version onlyReadOnly
True if this instance has a LevelConnector, filled or empty.
HasEmptyLevelConnectorboolFULL version onlyReadOnly
True if this instance has an empty LevelConnector.
HasFilledLevelConnectorboolFULL version onlyReadOnly
True if this instance has a filled LevelConnector.
HasDungeonConnectorboolReadOnly
True if this instance has a DungeonConnector, filled or empty.
HasEmptyDungeonConnectorboolReadOnly
True if this instance has an empty DungeonConnector.
HasFilledDungeonConnectorboolReadOnly
True if this instance has a filled DungeonConnector.
AvailableToSpawnKeyboolFULL version onlyReadOnly
Gets a value indicating whether this Room is available to spawn a key.
InstantiatedboolReadOnly
Gets a value indicating whether this Room is currently instantiated by a RenderInstantiate.
ActivatedboolReadOnly
Gets a value indicating whether this Room is activated by a RenderActivate.
MapGameObjectGameObjectReadOnly
Gets the map GameObject for this Room.
SpawnableTypesList<SpawnableType>ReadOnly
Gets all the SpawnableType of the Spawnables that were spawned in this Room.
SpawnableTypesToDisplayOnMapDictionarySpawnableType>ReadOnly
Gets a dictionary containing the SpawnableTypes to display on map. Based on SpawnableType displayMode / Room status + Spawnable detached. The SpawnableTypes found under key = true are completed. The SpawnableTypes found under key = false are not completed

Methods

ResetRoomNode
public void ResetRoomNode(Transform roomHolderTransform);
Parameters
roomHolderTransformTransformRoom holder transform.
Description
Resets a room node. Shouldn’t be called by users, this is public only for the RoomEditor script to use.
AdjustRoomNode
public void AdjustRoomNode(Transform roomHolderTransform) {;
Parameters
roomHolderTransformTransformRoom holder transform.
Description
Adjusts a room node. Shouldn’t be called by users, this is public only for the RoomEditor script to use.
ClearAllBaseSpawnPointSelectedConfigs
public void ClearAllBaseSpawnPointSelectedConfigs();
Description
Clears all BaseSpawnPoint selected configs.
RenderInstantiate
public void RenderInstantiate();
Description
Render the specified Room, instantiating the GameObjects.
RenderActivate
public void RenderActivate();
Description
Renders a Room by activating it. It must be instantiated first for this to work.
UnrenderDestroy
public void UnrenderDestroy();
Description
Unrenders this Room by destroying GameObjects.
UnrenderDeactivate
public void UnrenderDeactivate();
Description
Unrenders this Room by deactivating GameObjects.
UnrenderDetachedSpawnables
public void UnrenderDetachedSpawnables();
Description
Unrenders the detached spawnables. Usually called when leaving the Level.
DrawRoom
public void DrawRoom(bool characterInsideRoom);
Parameters
characterInsideRoomboolTrue if the Dungeon Character is inside the Room; otherwise, false. Used to draw the Dungeon Character’s location on the map.
Description
Draws the Room on the map.
IsDiscovered
public bool IsDiscovered();
Return
boolTrue if the Room has RoomStatus discovered or visited.
Description
Determines whether this Room instance is discovered. Visited is considered discovered.
GetRoomConnectorPointByDirection
public RoomConnectorPoint GetRoomConnectorPointByDirection(Direction direction);
Parameters
directionDirectionThe default Direction of the requested RoomConnectorPoint.
Return
RoomConnectorPointThe RoomConnectorPoint pointing toward the requested Direction.
Description
Gets the RoomConnectorPoint by Direction. (by default direction, room rotation is irrelevant)
GetRoomConnectorPointByRealDirection
public RoomConnectorPoint GetRoomConnectorPointByRealDirection(Direction direction);
Parameters
directionDirectionThe real Direction of the requested RoomConnectorPoint.
Return
RoomConnectorPointThe RoomConnectorPoint pointing toward the requested Direction.
Description
Gets the RoomConnectorPoint by its real Direction. (when Room rotation is applied)
GetNeighborOpposingRoomConnectorPoint
public RoomConnectorPoint GetNeighborOpposingRoomConnectorPoint(RoomConnectorPoint roomConnectorPoint);
Parameters
roomConnectorPointRoomConnectorPointThe RoomConnectorPoint for which the neighboring Room’s opposing RoomConnectorPoint is requested.
Return
RoomConnectorPointThe neighboring Room’s opposing RoomConnectorPoint.
Description
Gets the neighboring Room’s opposing RoomConnectorPoint. The opposing The neighboring Room’s opposing RoomConnectorPoint connects with the one passed in params.
GetNeighborByRealDirection
public Room GetNeighborByRealDirection(Direction direction);
Parameters
directionDirectionThe Direction in which the neighboring Room is requested.
Return
RoomThe neighbor Room if any; otherwise, null.
Description
Gets the neighbor Room by a specified Direction. If you use this method to find the neighbor pointed by a RoomConnectorPoint, pass the RoomConnectorPoint realDirection.
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 Room with a specified SpawnableType.
Description
Counts number of Spawnables generated in the Room 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 Room.
Description
Counts number of a specified Spawnable instances generated in the Room.
IsPositionWithinRoom
public bool IsPositionWithinRoom(Vector3 worldPosition);
Parameters
worldPositionVector3A world position (local position will not work)
Return
boolTrue if worldPosition is located within the Room; otherwise, false.
Description
Verifies if a world position is located within the bounding box of a Room. It will not verify the depth of walls and such, only the bounding box.
CalculatePercentLocationOfPosition
public Vector3 CalculatePercentLocationOfPosition(Vector3 worldPosition);
Parameters
worldPositionVector3A world position (local position will not work)
Return
Vector3The percent location of position.
Description
Calculates the percent location of a position. Used to calculate where the a character is located within a room.
CollectAllConnectedRooms
public List CollectAllConnectedRooms();
Return
ListA list of connected rooms
Description
Collects all from this level rooms connected to this room directly (direct neighbor) or indirectly (through a series of connected neighbors)
IsConnectedToNeighborForRealDirection
public bool IsConnectedToNeighborForRealDirection(Direction direction);
Parameters
directionDirectionReal direction
Return
boolTrue if a neighbor is found and is connnected to the current room via a non-wall connector
Description
Verifies if there is a neighbor in specified real direction
GetPossibleRoomExtensionCoordinates
public List GetPossibleRoomExtensionCoordinates();
Return
List<Point>A list of possible coordinates where to place a new room
Description
Gets the possible room extension coordinates.
IsAtLevelLimit
public bool IsAtLevelLimit(Direction direction);
Parameters
directionDirectionReal direction
Return
boolTrue if the room is at level limit for the specified direction; otherwise, false
Description
Determines whether the room is at level limit for the specified direction.
ForceCacheRefresh
public void ForceCacheRefresh();
Description
Forces a refresh of the cached properties. No need to use this unless you add connectors or spawn points programmatically.