ManiaMap.Godot
Procedural generation of metroidvania style maps for Godot .NET.
LayoutPack Class Reference

Holds the current Layout and LayoutState. More...

Public Member Functions

bool DoorExists (Uid id, Vector2DInt position, DoorDirection direction)
 Returns true if the door exists for the specified cell index and direction. More...
 
DoorConnection FindDoorConnection (Uid id, Vector2DInt position, DoorDirection direction)
 Returns the door connection with the given room ID, position, and direction if it exists. Returns null if the connection does not exist. More...
 
IReadOnlyList< DoorConnection > GetDoorConnections (Uid id)
 Returns a list of door connections with a room for the specified room ID. If the room ID does not exist, returns an empty list. More...
 
IEnumerable< int > GetLayerCoordinates ()
 Returns an enumerable of unique layer (z) coordinates for the layout. The coordinates are not in any particular order. More...
 
IReadOnlyList< DoorPosition > GetRoomDoors (Uid id)
 Returns a list of door positions for the specified room ID. If the room ID does not exist, returns an empty list. More...
 
IReadOnlyList< Room > GetRoomsInLayer (int z)
 Returns a list of rooms corresponding to the specified layer (z) coordinate. If the layer does not exist, returns an empty list. More...
 
 LayoutPack (Layout layout, LayoutState state, ManiaMapSettings settings=null)
 Initializes a new layout pack. More...
 
 LayoutPack (Layout layout, LayoutState state, string settingsPath)
 Initializes a new layout pack. More...
 

Properties

Layout Layout [get]
 The layout. More...
 
LayoutState LayoutState [get]
 The layout state. More...
 
Dictionary< Uid, List< DoorConnection > > RoomConnections = new Dictionary<Uid, List<DoorConnection>>() [get]
 A dictionary of door connections by room ID. More...
 
Dictionary< Uid, List< DoorPosition > > RoomDoors = new Dictionary<Uid, List<DoorPosition>>() [get]
 A dictionary of door positions by room ID. More...
 
Dictionary< int, List< Room > > RoomsByLayer = new Dictionary<int, List<Room>>() [get]
 A dictionary of rooms by layer coordinate. More...
 
ManiaMapSettings Settings [get]
 The settings. More...
 

Detailed Description

Holds the current Layout and LayoutState.

Definition at line 12 of file LayoutPack.cs.

Constructor & Destructor Documentation

◆ LayoutPack() [1/2]

LayoutPack ( Layout  layout,
LayoutState  state,
string  settingsPath 
)

Initializes a new layout pack.

Parameters
layoutThe layout.
stateThe layout state.
settingsPathThe path to the ManiaMapSettings resource.

Definition at line 50 of file LayoutPack.cs.

◆ LayoutPack() [2/2]

LayoutPack ( Layout  layout,
LayoutState  state,
ManiaMapSettings  settings = null 
)

Initializes a new layout pack.

Parameters
layoutThe layout.
stateThe layout state.
settingsThe settings resource. If null, a new default instance of the settings will be used.
Exceptions
ArgumentNullExceptionThrown if the layout or layout state is null.
ArgumentExceptionThrown if the layout and layout state ID's do not match.

Definition at line 64 of file LayoutPack.cs.

Member Function Documentation

◆ DoorExists()

bool DoorExists ( Uid  id,
Vector2DInt  position,
DoorDirection  direction 
)

Returns true if the door exists for the specified cell index and direction.

Parameters
idThe room ID.
positionThe cell index in the room.
directionThe door direction.

Definition at line 122 of file LayoutPack.cs.

◆ FindDoorConnection()

DoorConnection FindDoorConnection ( Uid  id,
Vector2DInt  position,
DoorDirection  direction 
)

Returns the door connection with the given room ID, position, and direction if it exists. Returns null if the connection does not exist.

Parameters
idThe room ID.
positionThe cell position index.
directionThe door direction.

Definition at line 149 of file LayoutPack.cs.

◆ GetDoorConnections()

IReadOnlyList< DoorConnection > GetDoorConnections ( Uid  id)

Returns a list of door connections with a room for the specified room ID. If the room ID does not exist, returns an empty list.

Parameters
idThe room ID.

Definition at line 85 of file LayoutPack.cs.

◆ GetLayerCoordinates()

IEnumerable< int > GetLayerCoordinates ( )

Returns an enumerable of unique layer (z) coordinates for the layout. The coordinates are not in any particular order.

Definition at line 137 of file LayoutPack.cs.

◆ GetRoomDoors()

IReadOnlyList< DoorPosition > GetRoomDoors ( Uid  id)

Returns a list of door positions for the specified room ID. If the room ID does not exist, returns an empty list.

Parameters
idThe room ID.

Definition at line 109 of file LayoutPack.cs.

◆ GetRoomsInLayer()

IReadOnlyList< Room > GetRoomsInLayer ( int  z)

Returns a list of rooms corresponding to the specified layer (z) coordinate. If the layer does not exist, returns an empty list.

Parameters
zThe layer coordinate.

Definition at line 97 of file LayoutPack.cs.

Property Documentation

◆ Layout

Layout Layout
get

The layout.

Definition at line 17 of file LayoutPack.cs.

◆ LayoutState

LayoutState LayoutState
get

The layout state.

Definition at line 22 of file LayoutPack.cs.

◆ RoomConnections

Dictionary<Uid, List<DoorConnection> > RoomConnections = new Dictionary<Uid, List<DoorConnection>>()
getprivate

A dictionary of door connections by room ID.

Definition at line 32 of file LayoutPack.cs.

◆ RoomDoors

Dictionary<Uid, List<DoorPosition> > RoomDoors = new Dictionary<Uid, List<DoorPosition>>()
getprivate

A dictionary of door positions by room ID.

Definition at line 42 of file LayoutPack.cs.

◆ RoomsByLayer

Dictionary<int, List<Room> > RoomsByLayer = new Dictionary<int, List<Room>>()
getprivate

A dictionary of rooms by layer coordinate.

Definition at line 37 of file LayoutPack.cs.

◆ Settings

ManiaMapSettings Settings
get

The settings.

Definition at line 27 of file LayoutPack.cs.


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