![]() |
ManiaMap.Godot
Procedural generation of metroidvania style maps for Godot .NET.
|
Provides lookup of RoomTemplateResource by ID and initialization methods for rooms. More...
Public Member Functions | |
RoomNode2D | CreateRoom2DInstance (Uid id, LayoutPack layoutPack, Node parent, bool assignLayoutPosition=false) |
Creates a room from the current Layout . Returns the instantiated room. More... | |
async Task< RoomNode2D > | CreateRoom2DInstanceAsync (Uid id, LayoutPack layoutPack, Node parent, bool assignLayoutPosition=false, bool useSubThreads=false) |
Asynchronously creates a room from the current Layout . Returns the instantiated room. More... | |
List< RoomNode2D > | CreateRoom2DInstances (Node parent, LayoutPack layoutPack, int? z=null) |
Creates rooms at their layout positions for a layer of the current Layout . Returns a list of the instantiated rooms. More... | |
async Task< List< RoomNode2D > > | CreateRoom2DInstancesAsync (Node parent, LayoutPack layoutPack, int? z=null, bool useSubThreads=false) |
Asynchronously creates rooms at their layout positions for a layer of the current Layout . Returns a list of the instantiated rooms. More... | |
RoomNode3D | CreateRoom3DInstance (Uid id, LayoutPack layoutPack, Node parent, bool assignLayoutPosition=false) |
Creates a room from the current Layout . Returns the instantiated room. More... | |
async Task< RoomNode3D > | CreateRoom3DInstanceAsync (Uid id, LayoutPack layoutPack, Node parent, bool assignLayoutPosition=false, bool useSubThreads=false) |
Asynchronously creates a room from the current Layout . Returns the instantiated room. More... | |
List< RoomNode3D > | CreateRoom3DInstances (Node parent, LayoutPack layoutPack) |
Creates rooms at their layout positions for the current Layout . Returns a list of the instantiated rooms. More... | |
async Task< List< RoomNode3D > > | CreateRoom3DInstancesAsync (Node parent, LayoutPack layoutPack, bool useSubThreads=false) |
Asynchronously creates rooms at their layout positions for the current Layout . Returns a list of the instantiated rooms. More... | |
RoomTemplateResource | GetRoomTemplate (int id) |
Returns the room template for the specified ID. More... | |
RoomTemplateResource | GetRoomTemplate (Uid id, LayoutPack layoutPack) |
Returns the room template for the specified room ID. This method uses the layout from the current ManiaMapManager. More... | |
IReadOnlyDictionary< int, RoomTemplateResource > | GetRoomTemplates () |
Returns a read-only dictionary of room templates by ID. More... | |
void | SetDirty () |
Sets the database as dirty and requiring update. More... | |
Properties | |
bool | IsDirty = true [getprivate set] |
True if the object is currently dirty and requires update. More... | |
Dictionary< int, RoomTemplateResource > | RoomTemplates = new Dictionary<int, RoomTemplateResource>() [get] |
A dictionary of room templates by ID. More... | |
TemplateGroup[] | TemplateGroups = Array.Empty<TemplateGroup>() [getset] |
An array of template groups containing the rooms to include in queries. More... | |
Private Member Functions | |
async Task< Dictionary< int, PackedScene > > | LoadScenesAsync (IEnumerable< Room > rooms, bool useSubThreads=false) |
Loads the scenes for the specified rooms asynchronously and returns a dictionary of scenes by template ID. More... | |
void | PopulateIfDirty () |
Populates the lookup dictionary if the room is marked as dirty. More... | |
void | PopulateRoomTemplates () |
Clears and populates the room templates dictionary. More... | |
Provides lookup of RoomTemplateResource by ID and initialization methods for rooms.
The database performs lazy initialization of its lookup dictionary. If you edit this resource at runtime, you should call the SetDirty method to ensure the database is updated before future queries.
Definition at line 19 of file RoomTemplateDatabase.cs.
RoomNode2D CreateRoom2DInstance | ( | Uid | id, |
LayoutPack | layoutPack, | ||
Node | parent, | ||
bool | assignLayoutPosition = false |
||
) |
Creates a room from the current Layout
. Returns the instantiated room.
id | The room ID. |
parent | The node serving as the room's parent. |
assignLayoutPosition | If true, the layout position will be assigned to the room. |
Definition at line 251 of file RoomTemplateDatabase.cs.
async Task< RoomNode2D > CreateRoom2DInstanceAsync | ( | Uid | id, |
LayoutPack | layoutPack, | ||
Node | parent, | ||
bool | assignLayoutPosition = false , |
||
bool | useSubThreads = false |
||
) |
Asynchronously creates a room from the current Layout
. Returns the instantiated room.
id | The room ID. |
parent | The node serving as the room's parent. |
assignLayoutPosition | If true, the layout position will be assigned to the room. |
Definition at line 225 of file RoomTemplateDatabase.cs.
List< RoomNode2D > CreateRoom2DInstances | ( | Node | parent, |
LayoutPack | layoutPack, | ||
int? | z = null |
||
) |
Creates rooms at their layout positions for a layer of the current Layout
. Returns a list of the instantiated rooms.
parent | The node serving as the parent of the rooms. |
z | The layer coordinate to instantiate. |
Definition at line 183 of file RoomTemplateDatabase.cs.
async Task< List< RoomNode2D > > CreateRoom2DInstancesAsync | ( | Node | parent, |
LayoutPack | layoutPack, | ||
int? | z = null , |
||
bool | useSubThreads = false |
||
) |
Asynchronously creates rooms at their layout positions for a layer of the current Layout
. Returns a list of the instantiated rooms.
parent | The node serving as the parent of the rooms. |
z | The layer coordinate to instantiate. |
Definition at line 141 of file RoomTemplateDatabase.cs.
RoomNode3D CreateRoom3DInstance | ( | Uid | id, |
LayoutPack | layoutPack, | ||
Node | parent, | ||
bool | assignLayoutPosition = false |
||
) |
Creates a room from the current Layout
. Returns the instantiated room.
id | The room ID. |
parent | The node serving as the room's parent. |
assignLayoutPosition | If true, the layout position will be assigned to the room. |
Definition at line 264 of file RoomTemplateDatabase.cs.
async Task< RoomNode3D > CreateRoom3DInstanceAsync | ( | Uid | id, |
LayoutPack | layoutPack, | ||
Node | parent, | ||
bool | assignLayoutPosition = false , |
||
bool | useSubThreads = false |
||
) |
Asynchronously creates a room from the current Layout
. Returns the instantiated room.
id | The room ID. |
parent | The node serving as the room's parent. |
assignLayoutPosition | If true, the layout position will be assigned to the room. |
Definition at line 238 of file RoomTemplateDatabase.cs.
List< RoomNode3D > CreateRoom3DInstances | ( | Node | parent, |
LayoutPack | layoutPack | ||
) |
Creates rooms at their layout positions for the current Layout
. Returns a list of the instantiated rooms.
parent | The node serving as the parent of the rooms. |
Definition at line 205 of file RoomTemplateDatabase.cs.
async Task< List< RoomNode3D > > CreateRoom3DInstancesAsync | ( | Node | parent, |
LayoutPack | layoutPack, | ||
bool | useSubThreads = false |
||
) |
Asynchronously creates rooms at their layout positions for the current Layout
. Returns a list of the instantiated rooms.
parent | The node serving as the parent of the rooms. |
Definition at line 162 of file RoomTemplateDatabase.cs.
RoomTemplateResource GetRoomTemplate | ( | int | id | ) |
Returns the room template for the specified ID.
id | The template ID. |
Definition at line 91 of file RoomTemplateDatabase.cs.
RoomTemplateResource GetRoomTemplate | ( | Uid | id, |
LayoutPack | layoutPack | ||
) |
Returns the room template for the specified room ID. This method uses the layout from the current ManiaMapManager.
id | The room ID. |
Definition at line 102 of file RoomTemplateDatabase.cs.
IReadOnlyDictionary< int, RoomTemplateResource > GetRoomTemplates | ( | ) |
Returns a read-only dictionary of room templates by ID.
Definition at line 39 of file RoomTemplateDatabase.cs.
|
private |
Loads the scenes for the specified rooms asynchronously and returns a dictionary of scenes by template ID.
rooms | The rooms for which scenes will be loaded. |
Definition at line 112 of file RoomTemplateDatabase.cs.
|
private |
Populates the lookup dictionary if the room is marked as dirty.
Definition at line 56 of file RoomTemplateDatabase.cs.
|
private |
Clears and populates the room templates dictionary.
DuplicateIdException | Thrown if two different room templates have the same ID. |
Definition at line 69 of file RoomTemplateDatabase.cs.
void SetDirty | ( | ) |
Sets the database as dirty and requiring update.
Definition at line 48 of file RoomTemplateDatabase.cs.
|
getprivate set |
True if the object is currently dirty and requires update.
Definition at line 34 of file RoomTemplateDatabase.cs.
|
getprivate |
A dictionary of room templates by ID.
Definition at line 29 of file RoomTemplateDatabase.cs.
|
getset |
An array of template groups containing the rooms to include in queries.
Definition at line 24 of file RoomTemplateDatabase.cs.