Class DeformUserToolStateBase<TBrushTarget, TTerrainLayer, TDataLayer>
Provides a base state for user tools that deform terrain by applying values to a data layer, supporting turbo and invert key modifiers for brush operations.
Inheritance
Implements
Inherited Members
Namespace: Fwt.HexTerrains.UserTools.SM.States
Assembly: fwt.hexterrains.dll
Syntax
public abstract class DeformUserToolStateBase<TBrushTarget, TTerrainLayer, TDataLayer> : DataLayerBrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer, TDataLayer, float>, ISmState where TBrushTarget : HexTerrainLayerGroup where TTerrainLayer : HexTerrainLayer where TDataLayer : CellValueDataLayer<float>
Type Parameters
| Name | Description |
|---|---|
| TBrushTarget | The type of terrain layer group that serves as the brush target for deformation operations. |
| TTerrainLayer | The type of terrain layer to which deformation is applied. |
| TDataLayer | The type of data layer that stores cell values affected by deformation. |
Remarks
This class enables user-driven terrain deformation by allowing configuration of key modifiers to control the direction and magnitude of applied values. Turbo and invert keys can be customized to adjust brush behavior during runtime. Derived classes can extend or override functionality to support specific deformation scenarios.
Constructors
DeformUserToolStateBase(ISmState)
Declaration
protected DeformUserToolStateBase(ISmState parent)
Parameters
| Type | Name | Description |
|---|---|---|
| ISmState | parent |
Properties
DataSourceItemsCount
Declaration
public int DataSourceItemsCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
InvertKey
When this key is pressed, the value applied to brush target is inverted
Declaration
public virtual KeyCode InvertKey { get; set; }
Property Value
| Type | Description |
|---|---|
| KeyCode |
IsClampResultValue
Declaration
public bool IsClampResultValue { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
MaxResultValue
Declaration
public float MaxResultValue { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
MinResultValue
Declaration
public float MinResultValue { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
TerrainLayerIndex
If IsGetLayerByIndex is true, this index is used to get terrain layer from terrain layers list."/>
Declaration
public override int TerrainLayerIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
TurboKey
When this key is pressed, the delta height value will be multiplied by Turbo Koeffitient
Declaration
public virtual KeyCode TurboKey { get; set; }
Property Value
| Type | Description |
|---|---|
| KeyCode |
TurboKoeffitient
Delta height multiplier that is applied if TurboKey is pressed
Declaration
public virtual float TurboKoeffitient { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Value
Value of deformation applied to DataLayer
Declaration
public virtual float Value { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
ApplyBrush(int, int2, int, TBrushTarget, int)
Applies brush to the brushView. Returns true if changes were applied
Declaration
public override bool ApplyBrush(int brushMode, int2 cellCoord, int cellIndex, TBrushTarget brushTarget, int mouseButton)
Parameters
| Type | Name | Description |
|---|---|---|
| int | brushMode | |
| int2 | cellCoord | |
| int | cellIndex | |
| TBrushTarget | brushTarget | |
| int | mouseButton |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
Init(UserToolStateSettings)
Initializes the tool state with the specified settings.
Declaration
public override void Init(UserToolStateSettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| UserToolStateSettings | settings | The settings to apply to the tool state. Cannot be null. |
Overrides
InitDefaultSettings()
Initializes the default settings for the current instance. This method is intended to be overridden in derived classes to configure initial values or options as needed.
Declaration
protected override void InitDefaultSettings()
Overrides
Remarks
Override this method in a subclass to provide custom initialization logic for default settings. The base implementation does not perform any actions.
Init<TInitArgs>(TInitArgs)
Initializes the tool using the specified initialization arguments.
Declaration
public override void Init<TInitArgs>(TInitArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| TInitArgs | args | The initialization arguments used to configure the tool. If the argument implements IUserToolStateConfig, its ToolSettings are used; otherwise, default settings are applied. |
Type Parameters
| Name | Description |
|---|---|
| TInitArgs | The type of the initialization arguments used to configure the tool. If the type implements IUserToolStateConfig, its ToolSettings will be used; otherwise, default settings are applied. |
Overrides
LoadSettings()
Loads configuration settings for the current instance. Derived classes override this method to implement custom settings initialization.
Declaration
protected override void LoadSettings()
Overrides
Remarks
Override this method in a subclass to provide specific logic for loading or initializing settings. This method is called during the setup or initialization phase and does not perform any actions in the base implementation.
SaveSettings()
Saves the current settings to the underlying storage or configuration source.
Declaration
protected override void SaveSettings()
Overrides
Remarks
Override this method in a derived class to implement custom logic for persisting settings. This method does not perform any action in the base implementation.