Class RoomInstanceGrid2D
Class that holds information about a laid out room.
Inheritance
Namespace: Edgar.Unity
Assembly: cs.temp.dll.dll
Syntax
public class RoomInstanceGrid2D
Constructors
RoomInstanceGrid2D(RoomBase, Boolean, ConnectionBase, GameObject, GameObject, Vector3Int, Polygon2D)
Declaration
public RoomInstanceGrid2D(RoomBase room, bool isCorridor, ConnectionBase connection, GameObject roomTemplatePrefab, GameObject roomTemplateInstance, Vector3Int position, Polygon2D outlinePolygon)
Parameters
Type | Name | Description |
---|---|---|
RoomBase | room | |
System.Boolean | isCorridor | |
ConnectionBase | connection | |
GameObject | roomTemplatePrefab | |
GameObject | roomTemplateInstance | |
Vector3Int | position | |
Polygon2D | outlinePolygon |
Properties
Connection
If this is a corridor room, this property contains the corresponding connection. Otherwise it is null.
Declaration
public ConnectionBase Connection { get; }
Property Value
Type | Description |
---|---|
ConnectionBase |
DoorLines
List of all the door lines that were available in the used room template. These door lines contain information about which tiles were actually used for doors and which not.
Declaration
public List<DoorLineInfoGrid2D> DoorLines { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<DoorLineInfoGrid2D> |
Doors
List of doors together with the information to which room they are connected.
Declaration
public List<DoorInstanceGrid2D> Doors { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<DoorInstanceGrid2D> |
Remarks
These doors are in the local space of the room template. If you want to see where exactly is the door situated in the level, you have to add the position of the room.
IsCorridor
Whether the room instance corresponds to a Room or to a Corridor.
Declaration
public bool IsCorridor { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
OutlinePolygon
The polygon that was used as the outline of the room.
Declaration
public Polygon2D OutlinePolygon { get; }
Property Value
Type | Description |
---|---|
Polygon2D |
Remarks
The polygon is affected by outline override, etc. The polygon is already correctly positioned, it is therefore not needed to add the position of the room to its points.
Position
Position of the room relative to the generated layout.
Declaration
public Vector3Int Position { get; }
Property Value
Type | Description |
---|---|
Vector3Int |
Remarks
To obtain a position in the combined tilemaps, this position must be added to relative positions of tile in Room's tilemaps.
Room
The room associated with this room instance.
Declaration
public RoomBase Room { get; }
Property Value
Type | Description |
---|---|
RoomBase |
Remarks
The value may be null for rooms that were created on the fly (e.g. corridors) and were serialized and later deserialized, because Unity cannot serialize such ScriptableObjects outside of Unity without creating corresponding asset files.
RoomTemplateInstance
Instance of the RoomTemplatePrefab that is correctly positioned.
Declaration
public GameObject RoomTemplateInstance { get; }
Property Value
Type | Description |
---|---|
GameObject |
Remarks
This is a new instance of a corresponding room template. It is moved to a correct position and transformed/rotated. It can be used to copy tiles from the template to the combined tilemaps.
RoomTemplatePrefab
Room template that was selected for a given room.
Declaration
public GameObject RoomTemplatePrefab { get; }
Property Value
Type | Description |
---|---|
GameObject |
Remarks
This is the original saved asset used in the input.