BGC Tools
Public Member Functions | Protected Member Functions | Private Attributes
BGC.StateMachine.LambdaState Class Reference

Simple State with optional lambda arguments for OnStateEnter and OnStateExit. More...

Inheritance diagram for BGC.StateMachine.LambdaState:
Inheritance graph
[legend]
Collaboration diagram for BGC.StateMachine.LambdaState:
Collaboration graph
[legend]

Public Member Functions

 LambdaState (string name, Action onStateEnter=null, Action onStateExit=null)
 
- Public Member Functions inherited from BGC.StateMachine.State
 State ()
 Create a state with the default name More...
 
 State (string name)
 Create a state with a custom name rather than the default More...
 
void OnEnter ()
 Called when the state is entered More...
 
void OnExit ()
 Called when the state is exited, before the next state is entered More...
 
virtual void Update ()
 This can be called every frame or whenever for complex states that have behavior on a frame by X basis. More...
 
void SetVerbose (bool isVerbose)
 Set whether the state machine is verbose or not More...
 

Protected Member Functions

override void OnStateEnter ()
 Called when the state is entered More...
 
override void OnStateExit ()
 Called when the state is exited before the next state is entered More...
 

Private Attributes

readonly Action onStateEnter
 
readonly Action onStateExit
 

Additional Inherited Members

- Protected Attributes inherited from BGC.StateMachine.State
virtual string DefaultName => "State"
 
- Properties inherited from BGC.StateMachine.State
string Name [get, private set]
 Name of the state. This will either be user defined or the default state name depending on the constructor used More...
 

Detailed Description

Simple State with optional lambda arguments for OnStateEnter and OnStateExit.

Definition at line 8 of file LambdaState.cs.

Constructor & Destructor Documentation

◆ LambdaState()

BGC.StateMachine.LambdaState.LambdaState ( string  name,
Action  onStateEnter = null,
Action  onStateExit = null 
)
inline

Definition at line 13 of file LambdaState.cs.

17  : base(name)
18  {
20  this.onStateExit = onStateExit;
21  }
readonly Action onStateExit
Definition: LambdaState.cs:11
readonly Action onStateEnter
Definition: LambdaState.cs:10

Member Function Documentation

◆ OnStateEnter()

override void BGC.StateMachine.LambdaState.OnStateEnter ( )
protectedvirtual

Called when the state is entered

Implements BGC.StateMachine.State.

◆ OnStateExit()

override void BGC.StateMachine.LambdaState.OnStateExit ( )
protectedvirtual

Called when the state is exited before the next state is entered

Reimplemented from BGC.StateMachine.State.

Field Documentation

◆ onStateEnter

readonly Action BGC.StateMachine.LambdaState.onStateEnter
private

Definition at line 10 of file LambdaState.cs.

◆ onStateExit

readonly Action BGC.StateMachine.LambdaState.onStateExit
private

Definition at line 11 of file LambdaState.cs.


The documentation for this class was generated from the following file: