Class LevelDescriptionGrid2D<TRoom>
Describes the structure of a level on the 2D (integer) grid.
Inheritance
Implements
Inherited Members
Namespace: Edgar.GraphBasedGenerator.Grid2D
Assembly: Edgar.dll
Syntax
public class LevelDescriptionGrid2D<TRoom> : LevelDescription<TRoom, RoomDescriptionGrid2D>, ILevelDescription<TRoom>
Type Parameters
Name | Description |
---|---|
TRoom |
Constructors
LevelDescriptionGrid2D()
Declaration
public LevelDescriptionGrid2D()
Properties
MinimumRoomDistance
Minimum distance of individual rooms. Must be a non-negative number. Defaults to 0.
Declaration
public int MinimumRoomDistance { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
n = 0 - a point can be contained on the outlines of multiple different rooms. n > 0 - the manhattan distance of 2 outline points of different rooms must be at least n.
Name
Name of the level description. Optional. Used mainly for debugging purposes.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
RoomTemplateRepeatModeDefault
Default room template repeat mode that is used if there is no repeat mode specified on the room template itself.
Declaration
public Nullable<RoomTemplateRepeatMode> RoomTemplateRepeatModeDefault { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<RoomTemplateRepeatMode> |
Remarks
Defaults to NoRepeat, i.e. room templates should not repeat in a level if possible.
RoomTemplateRepeatModeOverride
Room template repeat mode override that, when not null, overrides repeat modes from individual room templates.
Declaration
public Nullable<RoomTemplateRepeatMode> RoomTemplateRepeatModeOverride { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<RoomTemplateRepeatMode> |
Remarks
Defaults to null.
Methods
LoadFromJson(String)
Loads a level description from a given JSON file.
Declaration
public static LevelDescriptionGrid2D<TRoom> LoadFromJson(string filename)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | Path to the JSON file. |
Returns
Type | Description |
---|---|
LevelDescriptionGrid2D<TRoom> |
SaveToJson(String, Boolean)
Saves the level description as a JSON file.
Declaration
public void SaveToJson(string filename, bool preserveReferences = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | Path to the JSON file. |
System.Boolean | preserveReferences | Whether to preserve references to objects. The value should be true if the level description should be used later to generate a level. |