Hex Terrains Framework
Search Results for

    Show / Hide Table of Contents

    Class ViewModeConfigAssetBase

    Provides a base class for view mode configuration assets that manage color map updates for various terrain layers in a Unity environment.

    Inheritance
    object
    Object
    ScriptableObject
    ViewModeConfigAssetBase
    UniversalViewModeConfigAsset
    ViewModeConfigAsset
    Implements
    IViewModeConfig
    Inherited Members
    ScriptableObject.SetDirty()
    ScriptableObject.CreateInstance(string)
    ScriptableObject.CreateInstance(Type)
    ScriptableObject.CreateInstance<T>()
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.InstantiateAsync<T>(T)
    Object.InstantiateAsync<T>(T, Transform)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int)
    Object.InstantiateAsync<T>(T, int, Transform)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, CancellationToken)
    Object.InstantiateAsync<T>(T, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, InstantiateParameters, CancellationToken)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Scene)
    Object.Instantiate<T>(T, InstantiateParameters)
    Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(FindObjectsInactive)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Fwt.HexTerrains.ViewModes.Data
    Assembly: fwt.hexterrains.dll
    Syntax
    public abstract class ViewModeConfigAssetBase : ScriptableObject, IViewModeConfig
    Remarks

    This abstract class defines common functionality for updating color maps associated with terrain layers, such as height, biome, cell regions, and specialized GeoPlast layers. Derived classes should implement the required logic for updating color maps based on the current view mode. The class is intended to be used as a ScriptableObject asset and supports integration with Unity's Entity Component System (ECS).

    Fields

    _colorMapTexturesTemp

    Temporary list of color map textures used during color map updates. Used to avoid memory allocations when retrieving textures for updates.

    Declaration
    protected List<Texture2D> _colorMapTexturesTemp
    Field Value
    Type Description
    List<Texture2D>

    _description

    Declaration
    [SerializeField]
    [Tooltip("Description of the view mode.")]
    protected string _description
    Field Value
    Type Description
    string

    _icon

    Declaration
    [SerializeField]
    [Tooltip("Icon representing the view mode.")]
    protected Sprite _icon
    Field Value
    Type Description
    Sprite

    _name

    Declaration
    [SerializeField]
    [Tooltip("Name of the view mode.")]
    protected string _name
    Field Value
    Type Description
    string

    Properties

    Description

    Description of the view mode.

    Declaration
    public string Description { get; set; }
    Property Value
    Type Description
    string

    Icon

    Icon representing the view mode.

    Declaration
    public Sprite Icon { get; set; }
    Property Value
    Type Description
    Sprite

    Name

    Name of the view mode.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    string

    Methods

    GetColorMapTextures(EntityManager, Entity)

    Retrieves the collection of color map textures available for the specified terrain entity.

    Declaration
    public abstract IList<Texture2D> GetColorMapTextures(EntityManager entityManager, Entity terrainEntity)
    Parameters
    Type Name Description
    EntityManager entityManager

    The entity manager used to access and query entities and their components.

    Entity terrainEntity

    The entity representing the terrain for which to retrieve color map textures.

    Returns
    Type Description
    IList<Texture2D>

    A list of UnityEngine.Texture2D objects representing the color map textures for the specified terrain entity. The list is empty if no color map textures are found.

    GetTerrainLayer<TLayerComponent, TLayer>(EntityManager, Entity, HexTerrainLayerReference)

    Retrieves a terrain layer of the specified type from the given terrain entity using the provided layer reference.

    Declaration
    protected virtual TLayer GetTerrainLayer<TLayerComponent, TLayer>(EntityManager entityManager, Entity terrainEntity, HexTerrainLayerReference layerReference) where TLayerComponent : HexTerrainLayerGroup, IComponentData where TLayer : HexTerrainLayer
    Parameters
    Type Name Description
    EntityManager entityManager

    The EntityManager instance used to access components associated with entities.

    Entity terrainEntity

    The entity representing the terrain from which to retrieve the layer.

    HexTerrainLayerReference layerReference

    A reference identifying the specific terrain layer to retrieve.

    Returns
    Type Description
    TLayer

    The terrain layer of type TLayer if found; otherwise, the default value for TLayer.

    Type Parameters
    Name Description
    TLayerComponent

    The component type that represents a group of terrain layers and implements IComponentData.

    TLayer

    The type of terrain layer to retrieve.

    Remarks

    If the terrain entity does not contain the specified layer component, the method returns the default value for TLayer.

    IsSupportedLayer<TLayerComponent, TLayer>(EntityManager, Entity, HexTerrainLayerReference)

    Determines whether the specified terrain entity contains a supported layer of the given type.

    Declaration
    protected virtual bool IsSupportedLayer<TLayerComponent, TLayer>(EntityManager entityManager, Entity terrainEntity, HexTerrainLayerReference layerReference) where TLayerComponent : HexTerrainLayerGroup, IComponentData where TLayer : HexTerrainLayer
    Parameters
    Type Name Description
    EntityManager entityManager

    The EntityManager instance used to access entity components.

    Entity terrainEntity

    The entity representing the terrain to be queried.

    HexTerrainLayerReference layerReference

    A reference identifying the specific terrain layer to check.

    Returns
    Type Description
    bool

    true if the specified terrain entity contains a supported layer of the given type; otherwise, false.

    Type Parameters
    Name Description
    TLayerComponent

    The component type representing a group of terrain layers. Must implement HexTerrainLayerGroup and IComponentData.

    TLayer

    The type of the terrain layer to check for. Must derive from ChunkMeshLayer.

    UpdateColorMap(EntityManager, Entity, bool)

    Updates the color map textures associated with the specified terrain entity in the given entity manager. This method can be used to refresh or modify the color map based on the current view mode state.

    Declaration
    public abstract bool UpdateColorMap(EntityManager entityManager, Entity terrainEntity, bool isViewModeDirty)
    Parameters
    Type Name Description
    EntityManager entityManager

    The entity manager that manages the entities and their components. Must not be null.

    Entity terrainEntity

    The terrain entity whose color map textures are to be updated.

    bool isViewModeDirty

    Indicates whether the view mode has changed and requires the color map to be refreshed. If true, the color map will be updated accordingly.

    Returns
    Type Description
    bool

    true if the color map was updated; otherwise, false. Returns true if any data was changed, so the according logic can be applied after

    UpdateColorMapTexture(CellColorsDataLayer, bool, Texture2D)

    Declaration
    protected virtual bool UpdateColorMapTexture(CellColorsDataLayer colorMap, bool isViewModeDirty, Texture2D texture)
    Parameters
    Type Name Description
    CellColorsDataLayer colorMap
    bool isViewModeDirty
    Texture2D texture
    Returns
    Type Description
    bool

    Implements

    IViewModeConfig

    Extension Methods

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