Class SmState
Represents an abstract state within a state machine, providing the core lifecycle methods for state management.
Implements
Inherited Members
Namespace: Fwt.Core.StateMachines
Assembly: fwt.core.dll
Syntax
public abstract class SmState : ISmState
Remarks
Implementations of this class define the behavior for entering, exiting, and updating a state in a state machine. The methods should be overridden to specify actions that occur when the state is prepared to run, prepared to stop, or updated on each tick. This class is intended to be used as a base for concrete state implementations in state machine architectures.
Methods
PrepareToRun()
Performs any necessary initialization or setup required before executing the main operation. Called by state machine once when state becomes active. If state is disabled and then enabled again, this method will be called again.
Declaration
public abstract void PrepareToRun()
Remarks
Override this method to implement preparation logic specific to the derived class. This method should be called prior to running the core functionality to ensure all prerequisites are met.
PrepareToStop()
Performs any necessary actions to prepare the object for stopping or shutdown. Called when the state is about to be deactivated.
Declaration
public abstract void PrepareToStop()
Remarks
Implementations should ensure that all resources are released and any ongoing operations are safely terminated before the object is stopped. This method is typically called prior to disposing or shutting down the object to ensure a clean transition.
Tick()
Advances the state of the object by one time unit or processing step.
Declaration
public abstract void Tick()
Remarks
Derived classes should implement this method to perform periodic updates or actions. The specific behavior depends on the implementation.