Class UserToolStateBase
Base class for representing the state of a user tool within a state machine. Serves as the foundation for specific user tool state implementations.
Implements
Inherited Members
Namespace: Fwt.HexTerrains.UserTools.SM
Assembly: fwt.hexterrains.dll
Syntax
public abstract class UserToolStateBase : SmState, ISmState
Remarks
This class is intended to be inherited by concrete user tool state types that participate in a user tools state machine. It exposes common functionality and properties required for managing tool state transitions and configuration. Inheriting classes should implement the required members and may override virtual methods to customize behavior.
Constructors
UserToolStateBase(ISmState)
Declaration
protected UserToolStateBase(ISmState parent)
Parameters
| Type | Name | Description |
|---|---|---|
| ISmState | parent |
Properties
Parent
Parent state in the state machine hierarchy. For root states it's a state machine.
Declaration
protected virtual ISmState Parent { get; set; }
Property Value
| Type | Description |
|---|---|
| ISmState |
ParentStateMachine
Gets the parent state machine cast as a UserToolsStateMachine, if available.
Declaration
protected virtual UserToolsStateMachine ParentStateMachine { get; }
Property Value
| Type | Description |
|---|---|
| UserToolsStateMachine |
Remarks
Returns the parent object as a UserToolsStateMachine if the parent is of that type; otherwise, returns null. This property is useful for accessing functionality specific to UserToolsStateMachine from derived classes.
Settings
Settings specific to the user tool state.
Declaration
public virtual UserToolStateSettings Settings { get; set; }
Property Value
| Type | Description |
|---|---|
| UserToolStateSettings |
UserToolType
Type identifier for the user tool. Allows state machine to change states based on tool type instead of state index.
Declaration
public abstract int UserToolType { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Init(UserToolStateSettings)
Initializes the tool state with the specified settings.
Declaration
public virtual void Init(UserToolStateSettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| UserToolStateSettings | settings | The settings to apply to the tool state. Cannot be null. |
Init<TInitArgs>(TInitArgs)
Initializes the tool using the specified initialization arguments.
Declaration
public virtual 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. |
Tick()
Advances the state of the object by one tick, performing any periodic updates required.
Declaration
public override void Tick()