ManiaMap.Unity
Procedural generation of metroidvania style maps for Unity.
DoorComponent Class Reference

A component representing a possible door location. More...

Inheritance diagram for DoorComponent:
CellChild

Public Member Functions

override void AutoAssign (RoomComponent room)
 Auto assigns elements to the door. More...
 
bool DoorExists ()
 True if the door exists in the layout. More...
 
Door GetMMDoor ()
 Returns the Mania Map door used by the procedural generator. More...
 
Uid ToRoomId ()
 The room ID of the room this door connects to. More...
 

Static Public Member Functions

static DoorComponent FindDoor (Uid roomId, DoorConnection connection)
 Finds the door with the specified room ID and door connection. Returns null if the door is not found. More...
 

Protected Member Functions

override void Initialize ()
 Initializes the object. More...
 
override void OnDestroy ()
 
- Protected Member Functions inherited from CellChild
virtual void Awake ()
 

Properties

static Dictionary< Uid, LinkedList< DoorComponent > > ActiveDoorsByRoom = new Dictionary<Uid, LinkedList<DoorComponent>>() [get]
 A dictionary of door components in the scene by their room ID. More...
 
bool AutoAssignDirection [getset]
 If true, the door direction will be automatically assigned to the cell when update and save operations are performed. More...
 
DoorCode Code [getset]
 The door code. More...
 
DoorConnection Connection [getprivate set]
 The associated door connection in the layout. More...
 
DoorDirection Direction [getset]
 The door direction. More...
 
DoorType Type [getset]
 The door type. More...
 
- Properties inherited from CellChild
bool AutoAssignCell [getset]
 If true, the cell will be automatically assigned to the closest cell when update and save operations are performed. More...
 
Vector2Int CellIndex [getset]
 The containing cell index. More...
 
int Column [getset]
 The column index. More...
 
bool IsInitialized [getprotected set]
 True if the object has been initialized. More...
 
UnityEvent OnInitialize [getset]
 The event invoked after the object is initialized. More...
 
RoomComponent Room [getset]
 The containing room. More...
 
int Row [getset]
 The row index. More...
 

Private Member Functions

void AddToActiveDoors ()
 Adds the door to the doors dictionary. More...
 
DoorConnection FindDoorConnection ()
 Returns the door connection in the layout associated with the door. Returns null if the door connection does not exist in the layout. More...
 
void RemoveFromActiveDoors ()
 Removes the door from the doors dictionary. More...
 

Private Attributes

bool _autoAssignDirection = true
 
DoorCode _code
 
DoorDirection _direction
 
DoorType _type
 

Additional Inherited Members

- Protected Attributes inherited from CellChild
bool _autoAssignCell = true
 
Vector2Int _cellIndex
 
RoomComponent _room
 

Detailed Description

A component representing a possible door location.

Definition at line 11 of file DoorComponent.cs.

Member Function Documentation

◆ AddToActiveDoors()

void AddToActiveDoors ( )
private

Adds the door to the doors dictionary.

Definition at line 113 of file DoorComponent.cs.

◆ AutoAssign()

override void AutoAssign ( RoomComponent  room)
virtual

Auto assigns elements to the door.

Reimplemented from CellChild.

Definition at line 149 of file DoorComponent.cs.

◆ DoorExists()

bool DoorExists ( )

True if the door exists in the layout.

Definition at line 56 of file DoorComponent.cs.

◆ FindDoor()

static DoorComponent FindDoor ( Uid  roomId,
DoorConnection  connection 
)
static

Finds the door with the specified room ID and door connection. Returns null if the door is not found.

Parameters
roomIdThe room ID.
connectionThe door connection.

Definition at line 96 of file DoorComponent.cs.

◆ FindDoorConnection()

DoorConnection FindDoorConnection ( )
private

Returns the door connection in the layout associated with the door. Returns null if the door connection does not exist in the layout.

Definition at line 139 of file DoorComponent.cs.

◆ GetMMDoor()

Door GetMMDoor ( )

Returns the Mania Map door used by the procedural generator.

Definition at line 160 of file DoorComponent.cs.

◆ Initialize()

override void Initialize ( )
protectedvirtual

Initializes the object.

Reimplemented from CellChild.

Definition at line 79 of file DoorComponent.cs.

◆ OnDestroy()

override void OnDestroy ( )
protectedvirtual

Reimplemented from CellChild.

Definition at line 72 of file DoorComponent.cs.

◆ RemoveFromActiveDoors()

void RemoveFromActiveDoors ( )
private

Removes the door from the doors dictionary.

Definition at line 129 of file DoorComponent.cs.

◆ ToRoomId()

Uid ToRoomId ( )

The room ID of the room this door connects to.

Definition at line 64 of file DoorComponent.cs.

Member Data Documentation

◆ _autoAssignDirection

bool _autoAssignDirection = true
private

Definition at line 20 of file DoorComponent.cs.

◆ _code

DoorCode _code
private

Definition at line 42 of file DoorComponent.cs.

◆ _direction

DoorDirection _direction
private

Definition at line 28 of file DoorComponent.cs.

◆ _type

DoorType _type
private

Definition at line 35 of file DoorComponent.cs.

Property Documentation

◆ ActiveDoorsByRoom

Dictionary<Uid, LinkedList<DoorComponent> > ActiveDoorsByRoom = new Dictionary<Uid, LinkedList<DoorComponent>>()
staticgetprivate

A dictionary of door components in the scene by their room ID.

Definition at line 16 of file DoorComponent.cs.

◆ AutoAssignDirection

bool AutoAssignDirection
getset

If true, the door direction will be automatically assigned to the cell when update and save operations are performed.

Definition at line 25 of file DoorComponent.cs.

◆ Code

DoorCode Code
getset

The door code.

Definition at line 46 of file DoorComponent.cs.

◆ Connection

DoorConnection Connection
getprivate set

The associated door connection in the layout.

Definition at line 51 of file DoorComponent.cs.

◆ Direction

DoorDirection Direction
getset

The door direction.

Definition at line 32 of file DoorComponent.cs.

◆ Type

DoorType Type
getset

The door type.

Definition at line 39 of file DoorComponent.cs.


The documentation for this class was generated from the following file: