The State System provides a flexible and reusable way to manage entity behavior. It uses a StateMachine
to coordinate transitions between individual State
instances.
- StateMachine: Controls the active state of an entity.
- State: Represents an individual behavior, such as moving, attacking, or collecting resources.
stateDiagram-v2
[*] --> IdleState
IdleState --> MoveState: Move Command
MoveState --> IdleState: Destination Reached
MoveState --> AttackState: Enemy In Range
AttackState --> IdleState: Target Destroyed
IdleState --> CollectState: Collect Command
CollectState --> IdleState: Collection Complete