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

generationConfig RoomGenerationConfig The generation configuration for this Room.
mapConfig RoomMapConfig The map configuration of this Room.
renderConfig RoomRenderConfig The render configuration for this Room. Do not change this at runtime.
showGizmos bool Room gizmos in the scene view of Unity Editor. Useless at runtime.

Properties

Status RoomStatus Gets or sets the room status.
Coordinate Point ReadOnly
The coordinate of this Room in the Level.
RoomRotation PointRotation ReadOnly
The rotation of this Room in the Level.
Neighbors Neighbors ReadOnly
The Neighbors of this Room.
PrefabHolderGameObject GameObject ReadOnly
The GameObject that will be the parent of the Room prefab.
RoomNavMeshManager RoomNavMeshManager ReadOnly
Gets the RoomNavMeshManager component.
RoomTemplate Room ReadOnly
Gets the room template. (The room this instance is based on)
ConnectorPointsGameObject GameObject ReadOnly
The GameObject that will be the parent of this Room’s ConnectorPoints.
SpawnPointsGameObject GameObject ReadOnly
The GameObject that will be the parent of this Room’s SpawnPoints.
RoomTriggerGameObject GameObject ReadOnly
The GameObject that will be the parent of the RoomTrigger.
Level Level ReadOnly
The Level this Room is a part of.
SpawnPoints List<SpawnPoint> ReadOnly
The SpawnPoints located in this Room.
BaseConnectorPoints List<BaseConnectorPoint> ReadOnly
Gets all the ConnectorPoints located in this Room.
RoomConnectorPoints List<RoomConnectorPoint> ReadOnly
Gets all the RoomConnectorPoints located in this Room.
LevelConnectorPointFULL version only LevelConnectorPoint ReadOnly
Get the LevelConnectorPoint located in this Room if any; otherwise, null.
DungeonConnectorPoint DungeonConnectorPoint ReadOnly
Get the DungeonConnectorPoint located in this Room if any; otherwise, null.
HasLevelConnectorFULL version only bool ReadOnly
True if this instance has a LevelConnector, filled or empty.
HasEmptyLevelConnectorFULL version only bool ReadOnly
True if this instance has an empty LevelConnector.
HasFilledLevelConnectorFULL version only bool ReadOnly
True if this instance has a filled LevelConnector.
HasDungeonConnector bool ReadOnly
True if this instance has a DungeonConnector, filled or empty.
HasEmptyDungeonConnector bool ReadOnly
True if this instance has an empty DungeonConnector.
HasFilledDungeonConnector bool ReadOnly
True if this instance has a filled DungeonConnector.
AvailableToSpawnKeyFULL version only bool ReadOnly
Gets a value indicating whether this Room is available to spawn a key.
Instantiated bool ReadOnly
Gets a value indicating whether this Room is currently instantiated by a RenderInstantiate.
Activated bool ReadOnly
Gets a value indicating whether this Room is activated by a RenderActivate.
MapGameObject GameObject ReadOnly
Gets the map GameObject for this Room.
SpawnableTypes List<SpawnableType> ReadOnly
Gets all the SpawnableType of the Spawnables that were spawned in this Room.
SpawnableTypesToDisplayOnMap DictionarySpawnableType> 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
roomHolderTransform Transform Room 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
roomHolderTransform Transform Room 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
characterInsideRoom bool True 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
bool True if the Room has RoomStatus discovered or visited.
Description

Determines whether this Room instance is discovered. Visited ir considered discovered.

GetRoomConnectorPointByRealDirection
public RoomConnectorPoint GetRoomConnectorPointByRealDirection(Direction direction);
Parameters
direction Direction The Direction of the requested RoomConnectorPoint.
Return
RoomConnectorPoint The 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
roomConnectorPoint RoomConnectorPoint The RoomConnectorPoint for which the neighboring Room’s opposing RoomConnectorPoint is requested.
Return
RoomConnectorPoint The 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.

GetNeighborByDirection
public Room GetNeighborByDirection(Direction direction);
Parameters
direction Direction The Direction in which the neighboring Room is requested.
Return
Room The 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
spawnableType SpawnableType The SpawnableType with which generated Spawnable instances must be counted.
Return
int The 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
spawnable Spawnable The Spawnable for which generated instances must be counted.
Return
int The 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
worldPosition Vector3 A world position (local position will not work)
Return
bool True 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.

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.