Hex Terrains Framework
Search Results for

    Show / Hide Table of Contents

    Class HexSurfaceLayer

    Base class for all HexTerrain surfaces like a ground or water, etc. Create a new class that inherits from this one to create a new surface type.

    Inheritance
    object
    HexSurfaceLayer
    HexGroundLayer
    HexWaterLayer
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Fwt.HexTerrains.Surfaces.Data
    Assembly: fwt.hexterrains.dll
    Syntax
    public abstract class HexSurfaceLayer : IDisposable

    Properties

    BiomeColors

    Color palette for biomes. Used to paint the terrain with a color (CellColorMap). index in this array == Biome index. value in this array == Color of the biome in CellColorMap.

    Declaration
    public NativeList<Color32> BiomeColors { get; protected set; }
    Property Value
    Type Description
    NativeList<Color32>

    BiomesMap

    BiomesMap data layer. Contains biome index per cell CellBiomesDataLayer

    Declaration
    public CellBiomesDataLayer BiomesMap { get; protected set; }
    Property Value
    Type Description
    CellBiomesDataLayer

    CellColorMap

    CellColorMap data layer. Contains color value per cell CellColorsDataLayer Usually used for painting the terrain with a color (fill a Texture2D with this colors so it can be used in materials or UI like minimap).

    Declaration
    public CellColorsDataLayer CellColorMap { get; protected set; }
    Property Value
    Type Description
    CellColorsDataLayer

    CellMetrics

    CellMetrics data layer. Contains cell metrics metrics per cell CellMetricsDataLayer

    Declaration
    public CellMetricsDataLayer CellMetrics { get; protected set; }
    Property Value
    Type Description
    CellMetricsDataLayer

    ColorMapTextureIndex

    Index of the texture in the list of ColorMapTextures. Used externally in systems. Systems read this value to know which texture to fill with colors from CellColorMap data layer CellColorMap. That texture is expected to be used in materials or/and UI like minimap.

    Declaration
    public int ColorMapTextureIndex { get; set; }
    Property Value
    Type Description
    int

    HeightMap

    HeightMap data layer. Contains a byte height value per cell HeightMapDataLayer

    Declaration
    public HeightMapDataLayer HeightMap { get; protected set; }
    Property Value
    Type Description
    HeightMapDataLayer

    Settings

    Settings of the terrain this surface is from

    Declaration
    public HexTerrainSettings Settings { get; protected set; }
    Property Value
    Type Description
    HexTerrainSettings

    TerrainMetrics

    Metrics of the whole terrain. Recalculated when terrain settings are changed.

    Declaration
    public HexTerrainMetrics TerrainMetrics { get; protected set; }
    Property Value
    Type Description
    HexTerrainMetrics

    Methods

    Cleanup()

    Every frame there is a cleanup stage. This function is called. Usually used to clean the dirty flags.

    Declaration
    public virtual void Cleanup()

    CleanupAsync()

    Async version of Cleanup() Cleanup() Difference between regular Cleanup() is that it schedules jobs that clean up data layers, so you don't have to wait for the results and can continue working. Every frame there is a cleanup stage. This function is called. Usually used to clean the dirty flags.

    Declaration
    public virtual void CleanupAsync()

    CompleteAllJobs()

    Completes all jobs that affect data layers.

    Declaration
    public virtual void CompleteAllJobs()

    Dispose()

    Declaration
    public virtual void Dispose()

    GetCellBiome(int)

    Returns given cell biome.

    Declaration
    public virtual byte? GetCellBiome(int cellIndex)
    Parameters
    Type Name Description
    int cellIndex
    Returns
    Type Description
    byte?

    GetCellHeight(int)

    Returns given cell height.

    Declaration
    public virtual byte? GetCellHeight(int cellIndex)
    Parameters
    Type Name Description
    int cellIndex
    Returns
    Type Description
    byte?

    GetCellMetrics(int)

    Returns cell metrics of a cell at given index

    Declaration
    public virtual HexCellMetrics? GetCellMetrics(int cellIndex)
    Parameters
    Type Name Description
    int cellIndex
    Returns
    Type Description
    HexCellMetrics?

    Init(HexTerrainSettings)

    Initializes/Reinitializes the surface data.

    Declaration
    public virtual void Init(HexTerrainSettings settings)
    Parameters
    Type Name Description
    HexTerrainSettings settings

    new terrain settings

    Init(HexTerrainSettings, NativeArray<Color32>)

    Initializes/Reinitializes the surface data. Calls InitBiomeColors() internally to copy the color palette from the given array InitBiomeColors(NativeArray<Color32>). Only copies data from the copyColorPaletteFrom array, does not change or cache, so it is safe to dispose it after this call.

    Declaration
    public virtual void Init(HexTerrainSettings settings, NativeArray<Color32> copyColorPaletteFrom)
    Parameters
    Type Name Description
    HexTerrainSettings settings

    new terrain settings

    NativeArray<Color32> copyColorPaletteFrom

    array of colors per biome to copy a BiomeColors palette from

    InitBiomeColors(NativeArray<Color32>)

    Copies a BiomeColors palette from the given array. Does not change or cache the array, so it is safe to dispose it after this call. copyFrom array is expected to have the biomes count length, so there is one color per biome. BiomeIndex == index in copyFrom array.

    Declaration
    public virtual void InitBiomeColors(NativeArray<Color32> copyFrom)
    Parameters
    Type Name Description
    NativeArray<Color32> copyFrom

    array of colors to copy into the BiomeColors palette

    OpenAllToRead()

    Opens all data layers to read (Completes all the write jobs).

    Declaration
    public virtual void OpenAllToRead()

    OpenAllToWrite()

    Opens all data layers to write (Completes all the read and write jobs).

    Declaration
    public virtual void OpenAllToWrite()

    Resize(int2)

    Resizes the terrain to a new size. Internally calls Init() to reinitialize the data layers.

    Declaration
    public virtual void Resize(int2 size)
    Parameters
    Type Name Description
    int2 size

    new terrain size

    SetAllCellsBiome(byte)

    Paints terrain with given color. Does NOT mark anything dirty. It's recommended to call MarkAllChunksDirty() after call this function

    Declaration
    public virtual bool SetAllCellsBiome(byte value)
    Parameters
    Type Name Description
    byte value
    Returns
    Type Description
    bool

    SetAllCellsHeight(byte)

    Flatterns terrain at given height. Does NOT mark anything dirty. It's recommended to call MarkAllChunksDirty() after call this function

    Declaration
    public virtual bool SetAllCellsHeight(byte value)
    Parameters
    Type Name Description
    byte value
    Returns
    Type Description
    bool

    SetAllDirty(bool)

    Sets all chunks dirty. If isDirty == true, everything will be marked dirty and recalculated. If isDirty == false, everything will be marked clean and not recalculated.

    Declaration
    public virtual void SetAllDirty(bool isDirty = true)
    Parameters
    Type Name Description
    bool isDirty

    new dirty state

    SetBiomesMap(byte[])

    Applies given Colormap Does NOT make every chunk dirty, so it's recommended to call MarkAllChunksDirty() function after changes are applied

    Declaration
    public virtual bool SetBiomesMap(byte[] biomes)
    Parameters
    Type Name Description
    byte[] biomes
    Returns
    Type Description
    bool

    SetCellBiome(int, byte)

    Sets given cell color. Does NOT mark anything dirty, so it's recommended to call RegisterCellChange() function after all changes are applied

    Declaration
    public virtual bool SetCellBiome(int cellIndex, byte value)
    Parameters
    Type Name Description
    int cellIndex
    byte value
    Returns
    Type Description
    bool

    SetCellHeight(int, byte)

    Sets given cell height. Does NOT mark anything dirty, so it's recommended to call RegisterCellChange() function after all changes are applied

    Declaration
    public virtual bool SetCellHeight(int cellIndex, byte value)
    Parameters
    Type Name Description
    int cellIndex
    byte value
    Returns
    Type Description
    bool

    SetHeightMap(byte[])

    Applies given Heightmap1. Does NOT make every chunk dirty, so it's recommended to call MarkAllChunksDirty() function after changes are applied

    Declaration
    public virtual bool SetHeightMap(byte[] heights)
    Parameters
    Type Name Description
    byte[] heights
    Returns
    Type Description
    bool

    Implements

    IDisposable

    Extension Methods

    HashExtensions.GetHashCode_RefType<TValue>(TValue, int)
    HashExtensions.GetHashCode_RefType<TValue>(TValue, int)
    Extensions_UnityObject.SmartDestroy(object)
    Extensions_UnityObject.SmartDestroy(object)
    Extensions_UnityObject.SmartGetComponent<TComponent>(object)
    Extensions_UnityObject.SmartGetComponent<TComponent>(object)
    Extensions_UnityObject.SmartGetGameGameObject(object)
    Extensions_UnityObject.SmartGetGameGameObject(object)
    In this article
    Back to top Generated by DocFX