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. |
CharacterPositionPrefabGO | GameObject | ReadOnly Gets the character position prefab GameObject. |
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. |
LevelConnectorPoint | LevelConnectorPoint | FULL version onlyReadOnly 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. |
HasLevelConnector | bool | FULL version onlyReadOnly True if this instance has a LevelConnector, filled or empty. |
HasEmptyLevelConnector | bool | FULL version onlyReadOnly True if this instance has an empty LevelConnector. |
HasFilledLevelConnector | bool | FULL version onlyReadOnly 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. |
AvailableToSpawnKey | bool | FULL version onlyReadOnly 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 | Dictionary | 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 is considered discovered.GetRoomConnectorPointByDirection
public RoomConnectorPoint GetRoomConnectorPointByDirection(Direction direction);
Parameters
direction | Direction | The default Direction of the requested RoomConnectorPoint. |
Return
RoomConnectorPoint | The 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
direction | Direction | The real 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.GetNeighborByRealDirection
public Room GetNeighborByRealDirection(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.CalculatePercentLocationOfPosition
public Vector3 CalculatePercentLocationOfPosition(Vector3 worldPosition);
Parameters
worldPosition | Vector3 | A world position (local position will not work) |
Return
Vector3 | The 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
List | A 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
direction | Direction | Real direction |
Return
bool | True 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 directionGetPossibleRoomExtensionCoordinates
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
direction | Direction | Real direction |
Return
bool | True 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();