Class BrushUserToolState<TBrushTarget>
Inheritance
BrushUserToolState<TBrushTarget>
Assembly: fwt.hexterrains.dll
public abstract class BrushUserToolState<TBrushTarget> : UserToolStateBase, ISmState where TBrushTarget : class
Type Parameters
| Name |
Description |
| TBrushTarget |
|
Constructors
Declaration
public BrushUserToolState(IHexTerrainAPI userToolAPI)
Parameters
Fields
Declaration
[Tooltip("If true, applies brush by right mouse click")]
public bool AllowRightMouseButton
Field Value
Declaration
[Tooltip("If true, the brush size can be increased/decreased")]
public bool CanChangeBrushSize
Field Value
Declaration
public float ChangeOpacityMultiplier
Field Value
Used to prevent applying brush too fast (next change will be applied at least after this amount of seconds after previous change)
Declaration
[NonSerialized]
public float PrevChangeTimeStamp
Field Value
Declaration
[Tooltip("Next change to terrain will be applied not sooner then this time after previous change")]
public float TimeTreshold
Field Value
Properties
Declaration
public float BrushOpacity { get; }
Property Value
Declaration
public int BrushSize { get; }
Property Value
Declaration
public virtual KeyCode ChangeBrushSizeKey { get; set; }
Property Value
Declaration
[Tooltip("When this key is pressed, the brush mode will be 1 instead of default 0")]
public virtual KeyCode ChangeModeKey { get; set; }
Property Value
Declaration
[Tooltip("While this key pressed switches from changing size to changing opacity")]
public virtual KeyCode ChangeOpacityKey { get; set; }
Property Value
Declaration
public virtual Color32 CursorColor { get; set; }
Property Value
Declaration
[Tooltip("This key decreases brush size/opacity")]
public virtual KeyCode DecreaseBrushSizeKey { get; set; }
Property Value
Declaration
[Tooltip("This key decreases brush size/opacity")]
public virtual KeyCode DecreaseBrushSizeKey2 { get; set; }
Property Value
Declaration
[Tooltip("This key increases brush size/opacity")]
public virtual KeyCode IncreaseBrushSizeKey { get; set; }
Property Value
Declaration
[Tooltip("This key increases brush size/opacity")]
public virtual KeyCode IncreaseBrushSizeKey2 { get; set; }
Property Value
True if Time Treshold is already passed after previous change has been applied.
True means we can apply next brush change
Declaration
public bool IsTimeTresholdPassed { get; }
Property Value
Methods
Applies brush to the brushView. Returns true if changes were applied
Declaration
public abstract 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
Declaration
protected virtual bool ApplyBrushToAllBrushPoints(int brushMode, int2 centerCellCoord, int centerCellIndex, HexTerrainSettings terrainSettings, TBrushTarget brushTarget, int mouseButton)
Parameters
| Type |
Name |
Description |
| int |
brushMode |
|
| int2 |
centerCellCoord |
|
| int |
centerCellIndex |
|
| HexTerrainSettings |
terrainSettings |
|
| TBrushTarget |
brushTarget |
|
| int |
mouseButton |
|
Returns
Declaration
protected virtual bool ApplyBrushToAllCells(int brushMode, HexTerrainSettings settings, TBrushTarget brushTarget, int mouseButton)
Parameters
Returns
Declaration
protected virtual bool ApplyToSingleCell(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
Declaration
public virtual bool CanBeAppliedToManyPoints(int brushMode)
Parameters
| Type |
Name |
Description |
| int |
brushMode |
|
Returns
Declaration
public virtual TBrushTarget GetBrushTarget()
Returns
| Type |
Description |
| TBrushTarget |
|
Declaration
public virtual bool IsAppliedToEveryCellOnMap(int brushMode)
Parameters
| Type |
Name |
Description |
| int |
brushMode |
|
Returns
Declaration
public override void PrepareToRun()
Overrides
Declaration
public override void PrepareToStop()
Overrides
Saves current unscaled time as a new PrevChangeTimeStamp, which allows to prevent applying brush too often (see TimeTreshold)
Declaration
public void SetNewTimestamp()
Declaration
public override void Tick()
Overrides
Declaration
protected virtual void TryApplyBrush()
Declaration
protected virtual void UpdateBrush()
Implements
Extension Methods