Interface ISmState
Defines the contract for a state within a state machine, providing methods for initialization, shutdown preparation, and periodic updates.
Namespace: Fwt.Core.StateMachines
Assembly: fwt.core.dll
Syntax
public interface ISmState
Remarks
Implementations of this interface represent individual states managed by a state machine. Each state is responsible for handling its own setup, cleanup, and update logic. The state machine will invoke these methods at appropriate times during the state lifecycle. Implementers should ensure that resources are properly managed and that state transitions are handled safely.
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
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
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
void Tick()
Remarks
Derived classes should implement this method to perform periodic updates or actions. The specific behavior depends on the implementation.