Search Results for

    Show / Hide Table of Contents

    Class Map

    Describes the layout of the level. Set by the generators, and then used to populate the tilemaps.

    Inheritance
    Object
    Map
    Namespace: Global
    Assembly: cs.temp.dll.dll
    Syntax
    public class Map

    Constructors

    Map(Int32, Int32, TerrainGenerator.TerrainShape, Cell.CellStatus)

    Constructor for the Map. Fills the map with new cells with the given status (optional).

    Declaration
    public Map(int mapWidth, int mapHeight, TerrainGenerator.TerrainShape shape, Cell.CellStatus status = Cell.CellStatus.ValidCell)
    Parameters
    Type Name Description
    Int32 mapWidth

    The width of the map's 2D array.

    Int32 mapHeight

    The height of the map's 2D array.

    TerrainGenerator.TerrainShape shape

    The shape of the map's terrain.

    Cell.CellStatus status

    The status to set all cells to initially.

    Fields

    area

    The maps width multiplied by the maps height.

    Declaration
    public readonly int area
    Field Value
    Type Description
    Int32

    height

    The height of the map's 2D array.

    Declaration
    public readonly int height
    Field Value
    Type Description
    Int32

    shape

    The shape of the map's terrain.

    Declaration
    public readonly TerrainGenerator.TerrainShape shape
    Field Value
    Type Description
    TerrainGenerator.TerrainShape

    width

    The width of the map's 2D array.

    Declaration
    public readonly int width
    Field Value
    Type Description
    Int32

    Properties

    terrainCellCount

    Getter and setter for the current number of terrain cells on the map.

    Declaration
    public int terrainCellCount { get; }
    Property Value
    Type Description
    Int32

    Methods

    checkForBoundaryCell(Cell)

    Check if a given cell on a square or rectangular map is a boundary cell.

    Declaration
    public void checkForBoundaryCell(Cell cell)
    Parameters
    Type Name Description
    Cell cell

    The cell to be checked.

    checkForBoundaryCellRandom(Cell)

    Check if a given cell on a randomly shaped map is a boundary cell.

    Declaration
    public void checkForBoundaryCellRandom(Cell cell)
    Parameters
    Type Name Description
    Cell cell

    The cell to be checked.

    getBoundaryCellPositions()

    Get the list of boundary cell positions.

    Declaration
    public List<Vector2Int> getBoundaryCellPositions()
    Returns
    Type Description
    List<Vector2Int>

    The list of boundary cell positions.

    getCell(Int32, Int32)

    Get a cell from the map at the given x and y int positions.

    Declaration
    public Cell getCell(int x, int y)
    Parameters
    Type Name Description
    Int32 x

    The x position of the cell.

    Int32 y

    The y position of the cell.

    Returns
    Type Description
    Cell

    getCell(Vector2Int)

    Get a cell from the map at the given Vector2Int position.

    Declaration
    public Cell getCell(Vector2Int cellPosition)
    Parameters
    Type Name Description
    Vector2Int cellPosition

    The postion of the cell in VectorInt format.

    Returns
    Type Description
    Cell

    The cell at the position.

    getMinDepth(Cell, Boolean)

    Finds the minimum depth (z value) from the cells surrounding the cell given.

    Declaration
    public int getMinDepth(Cell currentCell, bool onlyTerrainCells = false)
    Parameters
    Type Name Description
    Cell currentCell

    The cell to find the minimum depth for.

    Boolean onlyTerrainCells

    Whether or not only terrain cells should be checked.

    Returns
    Type Description
    Int32

    The minimum depth amongst the cell and its neighbours.

    getNeighbours(Cell)

    Retrieve the von Neumann neighborhood neighbours of the cells given at a manhattan distance of 1.

    Declaration
    public List<Cell> getNeighbours(Cell currentCell)
    Parameters
    Type Name Description
    Cell currentCell

    The cell to get the neighbours for.

    Returns
    Type Description
    List<Cell>

    The list of all neighbouring cells.

    getRandomTerrainCellPosition()

    Get a random terrain cells position.

    Declaration
    public Vector3Int getRandomTerrainCellPosition()
    Returns
    Type Description
    Vector3Int

    A random terrain cell position.

    isValidCellPosition(Vector2Int)

    Checks whether the given position is a free terrain cell not on any bound.

    Declaration
    public bool isValidCellPosition(Vector2Int position)
    Parameters
    Type Name Description
    Vector2Int position

    The position to be checked.

    Returns
    Type Description
    Boolean

    Whether or not the there is a valid cell at the given position.

    updateBoundaryCellPositionList(List<Vector2Int>)

    Update the list of boundary cells with a modified list.

    Declaration
    public void updateBoundaryCellPositionList(List<Vector2Int> newboundaryCellPositions)
    Parameters
    Type Name Description
    List<Vector2Int> newboundaryCellPositions

    The new list of boundary cell positions.

    updateCellStatus(Cell, Cell.CellStatus, Boolean)

    Update the given cells status to a new status, and optinally specify whether intersections are on for cells along paths.

    Declaration
    public void updateCellStatus(Cell currentCell, Cell.CellStatus status, bool intersectionsEnabled = false)
    Parameters
    Type Name Description
    Cell currentCell

    The cell to be updated.

    Cell.CellStatus status

    The new status.

    Boolean intersectionsEnabled

    Whether or not a cell can be intersected. Used for path generation.

    In This Article
    Back to top Project documentation