Class LayoutRoomGrid2D<TRoom>
Represents a single room in the final layout. It contains information about the shape of the room, its position, etc.
Inheritance
Namespace: Edgar.GraphBasedGenerator.Grid2D
Assembly: Edgar.dll
Syntax
public class LayoutRoomGrid2D<TRoom> : Object
Type Parameters
Name | Description |
---|---|
TRoom |
Constructors
LayoutRoomGrid2D(TRoom, PolygonGrid2D, Vector2Int, Boolean, RoomTemplateGrid2D, RoomDescriptionGrid2D, TransformationGrid2D)
Declaration
public LayoutRoomGrid2D(TRoom room, PolygonGrid2D outline, Vector2Int position, bool isCorridor, RoomTemplateGrid2D roomTemplate, RoomDescriptionGrid2D roomDescription, TransformationGrid2D transformation)
Parameters
Type | Name | Description |
---|---|---|
TRoom | room | See the Room property. |
PolygonGrid2D | outline | See the Outline property. |
Vector2Int | position | See the Position property. |
System.Boolean | isCorridor | See the IsCorridor property. |
RoomTemplateGrid2D | roomTemplate | See the RoomTemplate property. |
RoomDescriptionGrid2D | roomDescription | See the RoomDescription property. |
TransformationGrid2D | transformation | See the Transformation property. |
Properties
Doors
Doors leading to neighboring rooms.
Declaration
public List<LayoutDoorGrid2D<TRoom>> Doors { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<LayoutDoorGrid2D<TRoom>> |
IsCorridor
Whether it is a corridor room or not.
Declaration
public bool IsCorridor { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Outline
Outline of the room.
Declaration
public PolygonGrid2D Outline { get; }
Property Value
Type | Description |
---|---|
PolygonGrid2D |
Remarks
The outline does not reflect the position of the room. To get a correctly positioned outline, the Position vector must be added to the Outline polygon.
If there was no transformation applied to the room template (i.e. the Transformation property is equal to Identity), the outline polygon is equal to the RoomTemplate.Outline polygon. If a transformation was applied (i.e. Rotate 90), the outline polygon is equal to RoomTemplate.Outline.Transform(transformation).
Position
Position of the room.
Declaration
public Vector2Int Position { get; }
Property Value
Type | Description |
---|---|
Vector2Int |
Room
Corresponding room from the level description.
Declaration
public TRoom Room { get; }
Property Value
Type | Description |
---|---|
TRoom |
RoomDescription
Description of the corresponding room.
Declaration
public RoomDescriptionGrid2D RoomDescription { get; }
Property Value
Type | Description |
---|---|
RoomDescriptionGrid2D |
RoomTemplate
Room template used for this room.
Declaration
public RoomTemplateGrid2D RoomTemplate { get; }
Property Value
Type | Description |
---|---|
RoomTemplateGrid2D |
Transformation
Transformation of the room template.
Declaration
public TransformationGrid2D Transformation { get; }
Property Value
Type | Description |
---|---|
TransformationGrid2D |
Remarks
If there were multiple transformations allowed for the room template, this property contains the transformation that was used for this instance of the room template.