Class TerrainGenerator
Responsible for generating the terrain.
Namespace: Global
Assembly: cs.temp.dll.dll
Syntax
public class TerrainGenerator
Constructors
TerrainGenerator(SpriteAtlas, List<String>)
The constructor for the TerrainGenerator. Sets all the tiles according to their types, and set the reference to the level generation info.
Declaration
public TerrainGenerator(SpriteAtlas atlas, List<string> generationInfo)
Parameters
Type | Name | Description |
---|---|---|
SpriteAtlas | atlas | A SpriteAtlas, holding all the sprites for the project. |
List<String> | generationInfo | A reference to the level generation information for the level. |
Fields
terrainMaxHeight
The maximum possible height of the terrain.
Declaration
public const int terrainMaxHeight = 5
Field Value
Type | Description |
---|---|
Int32 |
terrainMaxSize
The maximum possible size of a level specified by tile count.
Declaration
public const int terrainMaxSize = 2000
Field Value
Type | Description |
---|---|
Int32 |
terrainMinHeight
The minimum possible height of the terrain.
Declaration
public const int terrainMinHeight = 0
Field Value
Type | Description |
---|---|
Int32 |
terrainMinSize
The minimum possible size of a level specified by tile count.
Declaration
public const int terrainMinSize = 150
Field Value
Type | Description |
---|---|
Int32 |
terrainShapeCount
The number of options in the TerrainShape enumeration.
Declaration
public static int terrainShapeCount
Field Value
Type | Description |
---|---|
Int32 |
terrainTypeCount
The number of options in the TerrainType enumeration.
Declaration
public static int terrainTypeCount
Field Value
Type | Description |
---|---|
Int32 |
Methods
createMap()
Create the level map based on the terrain shape selected.
Declaration
public Map createMap()
Returns
Type | Description |
---|---|
Map | The level map. |
getAccessoryTiles()
Get the accessory tiles for the terrain type selected.
Declaration
public Tile[] getAccessoryTiles()
Returns
Type | Description |
---|---|
Tile[] | The terrains accessory tiles. |
getGroundTiles()
Get the ground tiles for the terrain type selected.
Declaration
public Tile[] getGroundTiles()
Returns
Type | Description |
---|---|
Tile[] | The terrains ground tiles. |
getLowerGroundTile()
Get the lower ground tile for the terrain type selected.
Declaration
public Tile getLowerGroundTile()
Returns
Type | Description |
---|---|
Tile | The terrains lower ground tile. |
populateCells(Map)
Update the map by adding the terrain cells.
Declaration
public void populateCells(Map map)
Parameters
Type | Name | Description |
---|---|---|
Map | map | A reference to the Map object, which represents the state of all cells in the level. |
setOuterBounds(Map, List<Vector3Int>, List<TileBase>, List<Vector3Int>, List<TileBase>)
Finds all the outer boundarys of the terrain. Used to limit player movement to only be on the generated level.
Declaration
public void setOuterBounds(Map map, List<Vector3Int> positions, List<TileBase> tiles, List<Vector3Int> positions2, List<TileBase> tiles2)
Parameters
Type | Name | Description |
---|---|---|
Map | map | A reference to the Map object, which represents the state of all cells in the level. |
List<Vector3Int> | positions | List of outer bound positions for the first outer bounds tilemap. |
List<TileBase> | tiles | List of outer bound tiles for the first outer bounds tilemap. |
List<Vector3Int> | positions2 | List of outer bound positions for the second outer bounds tilemap. |
List<TileBase> | tiles2 | List of outer bound tiles for the second outer bounds tilemap. |
setTerrainSettings(TerrainSettings)
Set the reference to the terrain settings.
Declaration
public void setTerrainSettings(TerrainSettings terrainSettings)
Parameters
Type | Name | Description |
---|---|---|
TerrainSettings | terrainSettings | The terrain settings to set a reference to. |