Class TStateMachine

Unit

Declaration

type TStateMachine = class(TObject)

Description

A State Machine implementation.

This object keeps track of the current states. It also calls the Enter and Leave state methods when current state changes.

To use this object create a TStateMachine object. Then assign the Current state and call the Update method to execute the state.

See also
TState
Base class for states.
TStateMachine.Current
Current state.
TStateMachine.Update
Execute Current and Global states.

Hierarchy

  • TObject
  • TStateMachine

Overview

Methods

Public procedure Update (aEntity: TObject);
Public procedure SwapPreviousState;

Properties

Public property Current: TState read fCurrentState write SetCurrentState;
Public property Global: TState read fGlobalState write SetGlobalState;

Description

Methods

Public procedure Update (aEntity: TObject);

Execute Current and Global states.

Parameters
aEntity
Object entity asociated with the state.
See also
TStateMachine.SwapPreviousState
Swap between Current and previous states.
TStateMachine.Current
Current state.
TStateMachine.Global
If assigned, it will be executed every time along with Current.
Public procedure SwapPreviousState;

Swap between Current and previous states.

See also
TStateMachine.Current
Current state.
TStateMachine.Global
If assigned, it will be executed every time along with Current.

Properties

Public property Current: TState read fCurrentState write SetCurrentState;

Current state.

Assigning this property will trigger the execution the Leave and Enter methods of the old and new state in the next call to Update.

See also
TStateMachine.Update
Execute Current and Global states.
TStateMachine.Global
If assigned, it will be executed every time along with Current.
TStateMachine.SwapPreviousState
Swap between Current and previous states.
Public property Global: TState read fGlobalState write SetGlobalState;

If assigned, it will be executed every time along with Current.

This state won't be affected by SwapPreviousState.

See also
TStateMachine.Current
Current state.
TStateMachine.SwapPreviousState
Swap between Current and previous states.

Generated by PasDoc 0.15.0. Generated on 2025-07-31 11:41:01.