• Manual
  • Scripting API
  • Asset Store
  • TycoonTerrain.Core
  • TerrainGrid
Search Results for

    Show / Hide Table of Contents
    • TycoonTerrain.Components
      • TycoonTileRendererBase
    • TycoonTerrain.Core
      • BoundsContainer
      • BoundsReservationRegister
      • CallbackHandle
      • CallbacksRegister
      • CardinalDirection
      • ChunkSet
      • ConstructableDefinition
      • CornerIndex
      • Extensions
      • IChunkListener
      • IntBound
      • LandTile
      • OnBoundsChangeCallback
      • PlacementValidResult
      • SurfaceOverlayMesh
      • TerrainGrid
      • TerrainModifiedEvent
      • TerrainSelection
      • TerrainTypeCollectionAsset
      • TerrainTypeDefinition
      • TerrainTypeTable
      • TileCorner
      • TileHandle
      • TilePosition
      • TileType
      • TycoonTileMap
      • TycoonTileRaycastHit
    • TycoonTerrain.Core.Generation
      • TerrainGenerationJob
    • TycoonTerrain.Core.Rendering
      • ChunkMesh
      • IMesh
      • NativeMeshData
      • RenderTerrainCliffChunkJob
      • RenderTerrainSurfaceChunkJob
      • RenderWaterChunkJob
      • RenderWaterCliffChunkJob
      • SubMeshTriangle
    • TycoonTerrain.Core.TerrainOperations
      • ClearWaterBodyOperation
      • CopyHeightMapOperation
      • CreateWaterBodyFloodOperation
      • DecreaseHeightCliffOperation
      • DecreaseHeightCorner
      • DecreaseHeightSmoothConnectedOperation
      • GetTilesInWaterBody
      • IncreaseHeightCliffOperation
      • IncreaseHeightCorner
      • IncreaseHeightSmoothConnectedOperation
      • ITerrainOperation
      • MaxHeightSmooth
      • OperationContext
      • OperationResult
      • SetHeightOperation
      • SetTileTypeInBoundsOperation
      • SetWaterLevelOperation
    • TycoonTerrain.Previewers
      • BuildingToolPreviewer
      • PreviewMeshes
      • TerrainPainterPreviewer
      • TerrainSelectionPreviewer
      • ToolPreviewerBase<T>
    • TycoonTerrain.Tools
      • BuildingTool
      • PainterTool
      • SceneryTool
      • SelectionToolBase
      • SnappingMode
      • TerraformingTool
      • ToolBase
      • WaterTool

    Struct TerrainGrid

    The terrain grid class is responsible for containing the LandTile data in a flattened 2D array.

    Namespace: TycoonTerrain.Core
    Assembly: TycoonTerrainAssembly.dll
    Syntax
    public struct TerrainGrid

    Fields

    Length

    The grid length.

    Declaration
    public int Length
    Field Value
    Type Description
    Int32

    The number of tiles in the z direction.

    MaxHeight

    Gets the maximum tile height.

    Declaration
    public byte MaxHeight
    Field Value
    Type Description
    Byte

    The maximum tile height.

    WaterHeightStepsPerTileHeight

    The water height steps per tile height.

    Declaration
    public int WaterHeightStepsPerTileHeight
    Field Value
    Type Description
    Int32

    The number of water levels that can be within a single tile height step.

    Width

    The grid width.

    Declaration
    public int Width
    Field Value
    Type Description
    Int32

    The number of tiles in the x direction.

    Properties

    Bounds

    Gets the grid bounds.

    Declaration
    public IntBound Bounds { get; }
    Property Value
    Type Description
    IntBound

    The grid bounds.

    MinHeight

    Gets the minimum tile height.

    Declaration
    public byte MinHeight { get; }
    Property Value
    Type Description
    Byte

    The minimum tile height.

    Methods

    GetTile(Int32, Int32)

    Gets the tile handle for a given tile position.

    Declaration
    public TileHandle GetTile(int x, int z)
    Parameters
    Type Name Description
    Int32 x
    Int32 z
    Returns
    Type Description
    TileHandle

    A TileHandle instance that refers to the tile at (x, z).

    GetTile(int2)

    Gets a handle to the tile at tilePosition

    Declaration
    public TileHandle GetTile(int2 tilePosition)
    Parameters
    Type Name Description
    Unity.Mathematics.int2 tilePosition

    The tile position.

    Returns
    Type Description
    TileHandle

    The tile handle that points to the tile at tilePosition.

    GetTilesIn(IntBound)

    Gets a TileHandle instance for every tile within the specified bounds.

    Declaration
    public IEnumerable<TileHandle> GetTilesIn(IntBound bounds)
    Parameters
    Type Name Description
    IntBound bounds

    The bounds.

    Returns
    Type Description
    IEnumerable<TileHandle>

    An enumerable of TileHandle instances that each refers to a tile within bounds.

    GetTilesInDonut(int2, Single, Single)

    Gets a TileHandle instance for every tile that lies in a donut shape, given the centerPosition, innerRadius and outerRadius.

    Declaration
    public IEnumerable<TileHandle> GetTilesInDonut(int2 centerPosition, float innerRadius, float outerRadius)
    Parameters
    Type Name Description
    Unity.Mathematics.int2 centerPosition

    The center position.

    Single innerRadius

    The inner radius.

    Single outerRadius

    The outer radius.

    Returns
    Type Description
    IEnumerable<TileHandle>

    A TileHandle instance for every tile that lies in a donut shape, given the centerPosition, innerRadius and outerRadius

    GetTilesInRadius(int2, Single)

    Gets a TileHandle instance for every tile that lies within the radius of the centerPosition.

    Declaration
    public IEnumerable<TileHandle> GetTilesInRadius(int2 centerPosition, float radius)
    Parameters
    Type Name Description
    Unity.Mathematics.int2 centerPosition

    The center position.

    Single radius

    The radius.

    Returns
    Type Description
    IEnumerable<TileHandle>

    A TileHandle instance for every tile that lies within the radius of the centerPosition.

    IntersectBound(IntBound)

    Gets the intersection of the given tile bounds with the grid bounds.

    Declaration
    public IntBound IntersectBound(IntBound bounds)
    Parameters
    Type Name Description
    IntBound bounds

    The tile bounds.

    Returns
    Type Description
    IntBound

    A IntBound instance that represents the intersection of bounds and the grid bounds.

    IsFlatInBounds(IntBound)

    Checks whether the tiles within the given bounds are all flat and at the same height.

    Declaration
    public bool IsFlatInBounds(IntBound bounds)
    Parameters
    Type Name Description
    IntBound bounds

    The tile bounds.

    Returns
    Type Description
    Boolean

    true if all tiles within bounds are flat and of equal height; otherwise, false.

    IsInBounds(int2)

    Check if a certain position is within the map bounds.

    Declaration
    public bool IsInBounds(int2 tilePosition)
    Parameters
    Type Name Description
    Unity.Mathematics.int2 tilePosition

    The tile position.

    Returns
    Type Description
    Boolean

    true if the position is within the map bounds; otherwise, false.

    ResetData()

    Resets all tile data to a flat surface at half the height limit.

    Declaration
    public void ResetData()
    In This Article
    • Fields
      • Length
      • MaxHeight
      • WaterHeightStepsPerTileHeight
      • Width
    • Properties
      • Bounds
      • MinHeight
    • Methods
      • GetTile(Int32, Int32)
      • GetTile(int2)
      • GetTilesIn(IntBound)
      • GetTilesInDonut(int2, Single, Single)
      • GetTilesInRadius(int2, Single)
      • IntersectBound(IntBound)
      • IsFlatInBounds(IntBound)
      • IsInBounds(int2)
      • ResetData()
    Back to top Tycoon Tile documentation