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

A manager for maintaining the current map data and state. 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 layoutState, ManiaMapSettings settings=null)
 Initializes a new object. More...
 

Properties

Layout Layout [get]
 The layout. More...
 
RectangleInt LayoutBounds [get]
 The bounds of 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 applied settings. More...
 

Detailed Description

A manager for maintaining the current map data and state.

Definition at line 11 of file LayoutPack.cs.

Constructor & Destructor Documentation

◆ LayoutPack()

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

Initializes a new object.

Parameters
layoutThe layout.
layoutStateThe layout state.
settingsThe Mania Map settings. If null, a new instance with default settings will be used.
Exceptions
System.ArgumentExceptionRaised if the layout or layout state is null or their ID's do not match.

Definition at line 55 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 115 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 142 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 78 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 130 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 102 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 90 of file LayoutPack.cs.

Property Documentation

◆ Layout

Layout Layout
get

The layout.

Definition at line 16 of file LayoutPack.cs.

◆ LayoutBounds

RectangleInt LayoutBounds
get

The bounds of the layout.

Definition at line 46 of file LayoutPack.cs.

◆ LayoutState

LayoutState LayoutState
get

The layout state.

Definition at line 21 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 31 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 41 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 36 of file LayoutPack.cs.

◆ Settings

ManiaMapSettings Settings
get

The applied settings.

Definition at line 26 of file LayoutPack.cs.


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