Class TState
Unit
a3dge.Classes
Declaration
type TState = class(TObject)
Description
Base class for states.
TState implements an abstract class to define a state. It introduces methods to define the behaviour of this state.
You can use the states or through a TStateMachine. Note that the object that uses the state may be not the Owner of the state. The owner is the object that contains the state. The object that uses the state is passed as a parameter to the Update method.
An instance of TState is never created directly, instead a descendant should be created. This is because TState is an abstract class which does not implement all methods.
See also
- TStateMachine
- A State Machine implementation.
Hierarchy
Overview
Methods
 |
procedure SetName (const aValue: AnsiString); virtual; |
 |
constructor Create; virtual; |
 |
procedure Enter (aEntity: TObject); virtual; |
 |
procedure Update (aEntity: TObject); virtual; abstract; |
 |
procedure Leave (aEntity: TObject); virtual; |
Properties
Description
Methods
 |
procedure SetName (const aValue: AnsiString); virtual; |
Sets name.
|
 |
constructor Create; virtual; |
Constructor.
|
 |
procedure Enter (aEntity: TObject); virtual; |
Prepare the state to be used.
This is called before the first use of the state to initialize it and the entity.
Parameters
- aEntity
- Object entity asociated with the state.
See also
- TState.Leave
- Clean state after using it.
|
 |
procedure Update (aEntity: TObject); virtual; abstract; |
Execute state.
Parameters
- aEntity
- Object entity asociated with the state.
See also
- TState.Enter
- Prepare the state to be used.
- TState.Leave
- Clean state after using it.
|
 |
procedure Leave (aEntity: TObject); virtual; |
Clean state after using it.
This is called after the last use of the state, because it changed, to clean and release resources when needed.
Remember that this method is called only when changing states and not when destroyed, so you should also add cleaning code in the destructor.
Parameters
- aEntity
- Object entity asociated with the state.
See also
- TState.Enter
- Prepare the state to be used.
|
Properties
 |
property Name: AnsiString read fName write SetName; |
State name.
|
Generated by PasDoc 0.15.0. Generated on 2025-07-31 11:41:01.
|