Hex Terrains Framework
Search Results for

    Show / Hide Table of Contents

    Class CellItemsLayer

    Base class for HexTerrain layers that contain a renderable CellItem per cell.

    Inheritance
    object
    CellItemsLayer
    CellItemPropsLayer
    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.CellItems.Data
    Assembly: fwt.hexterrains.dll
    Syntax
    public abstract class CellItemsLayer : IDisposable

    Fields

    CellItems

    Data layer for storing a CellItem per cell

    Declaration
    public CellItemDataLayer CellItems
    Field Value
    Type Description
    CellItemDataLayer

    CellTransforms

    Data layer for storing a CellTransform per cell (taken from the HexSurfaceLayer layer)

    Declaration
    public CellTransformDataLayer CellTransforms
    Field Value
    Type Description
    CellTransformDataLayer

    ItemsColorMap

    Data layer for storing a Color per cell

    Declaration
    public CellColorsDataLayer ItemsColorMap
    Field Value
    Type Description
    CellColorsDataLayer

    RenderEntitiesConfig

    RenderEntitiesConfig that stores meshes, materials and other settings for rendering meshes using Graphics.DrawMeshInstanced

    Declaration
    public RenderEntitiesConfig RenderEntitiesConfig
    Field Value
    Type Description
    RenderEntitiesConfig

    _renderEntities

    Declaration
    protected NativeParallelMultiHashMap<RenderEntitySettings, RenderEntity> _renderEntities
    Field Value
    Type Description
    NativeParallelMultiHashMap<RenderEntitySettings, RenderEntity>

    Properties

    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 ItemsColorMap data layer ItemsColorMap. 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

    ItemConfigs

    List of configs for every possible CellItem index

    Declaration
    public NativeList<CellItemConfig> ItemConfigs { get; protected set; }
    Property Value
    Type Description
    NativeList<CellItemConfig>

    RenderEntities

    MultiHashMap of RenderEntity that are used to render the CellItems. Key = RenderEntitySettings, Value = RenderEntity

    Declaration
    public NativeParallelMultiHashMap<RenderEntitySettings, RenderEntity> RenderEntities { get; protected set; }
    Property Value
    Type Description
    NativeParallelMultiHashMap<RenderEntitySettings, RenderEntity>

    Settings

    Settings of the Terrain this layer is attached to

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

    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 are scheduled for this layer.

    Declaration
    public virtual void CompleteAllJobs()

    Dispose()

    Declaration
    public virtual void Dispose()

    GetCellItem(int)

    Gets the CellItem value from the cell at the given index.

    Declaration
    public virtual CellItem? GetCellItem(int cellIndex)
    Parameters
    Type Name Description
    int cellIndex

    cell index where to get data from

    Returns
    Type Description
    CellItem?

    CellItem if found, otherwise - null

    Init(HexTerrainSettings)

    Initializes/Reinitializes the CellItems data.

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

    new terrain settings

    Init(HexTerrainSettings, NativeArray<CellItemConfig>, RenderEntitiesConfig)

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

    Declaration
    public virtual void Init(HexTerrainSettings settings, NativeArray<CellItemConfig> copyItemConfigFrom, RenderEntitiesConfig renderConfig)
    Parameters
    Type Name Description
    HexTerrainSettings settings

    new terrain settings

    NativeArray<CellItemConfig> copyItemConfigFrom

    array of colors per CellItem index to copy a ItemConfigs from

    RenderEntitiesConfig renderConfig

    RenderEntitiesConfig that stores meshes, materials and other settings for rendering meshes using Graphics.DrawMeshInstanced

    InitCellItemConfigs(NativeArray<CellItemConfig>)

    Copies an ItemConfigs 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 CellItem indexes length, so there is one config per possible CellItem index. CellItem.Index == index in copyFrom array.

    Declaration
    protected virtual void InitCellItemConfigs(NativeArray<CellItemConfig> copyItemsConfigFrom)
    Parameters
    Type Name Description
    NativeArray<CellItemConfig> copyItemsConfigFrom

    Resize(int2)

    Resizes the CellItems data. Calls Init() method to reinitialize the CellItems data.

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

    SetAllCellsItem(CellItem)

    Sets the CellItem value to all cells in the layer.

    Declaration
    public virtual bool SetAllCellsItem(CellItem value)
    Parameters
    Type Name Description
    CellItem value

    value to set to every cell

    Returns
    Type Description
    bool

    true if data was set, otherwise - false

    SetAllDirty(bool)

    Sets the dirty flag for all the data layers. If isDirty is true, all data layers will be marked as dirty and will be recalculated. If isDirty is false, all data layers will be marked as clean and will not be recalculated.

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

    SetCellItem(int, CellItem)

    Sets the CellItem value to the cell at the given index.

    Declaration
    public virtual bool SetCellItem(int cellIndex, CellItem item)
    Parameters
    Type Name Description
    int cellIndex

    cell index of the cell to set data to

    CellItem item

    data to set into the cell at cellIndex index

    Returns
    Type Description
    bool

    true if data was set, otherwise - false

    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