Concepts
Behaviors
A behavior is an entity that responds to an OnRun
observer, and will at some point trigger OnRunResult
.
Behaviors can be organized into a hierarchy using the same Parent
/Children
mechanism as transforms.
Control Flow
Control flow is directed using observers and can be triggered in one of a handful of scopes.
Common Observers
Name | Scope | Description |
---|---|---|
OnRun | Local | Indicate this behavior should start running |
OnRunResult | Local | Indicate this behavior has finished |
OnChildRunResult | Parent | A ‘bubble up’ mechanism that is triggered on parents of children who triggered OnRunResult |
OnAppReady | Global | All assets are loaded, used for delaying initial execution |
The Running
Component
Often behaviors are designed to continue running for some period of time. This is handled by the Running
component which is added OnRun
and removed OnRunResult
.
Request / Response
Sometimes actions need to request information in order to determine where to direct control flow, see the Utility AI Guide for an example.
Actions
Actions are components with associated functionality. Their roles vary from directing control flow to making changes to an agent like updating its Transform
.
For the purpose of modularity actions are usually very simple, for example Translate
and TriggerInDuration<RunResult>
could be added to a single entity to create a Translate For Duration
behavior.
Common Actions
Name | Inputs | Outputs | Description |
---|---|---|---|
EndOnRun | OnRun | OnRunResult | Listens for OnRun and immediately triggers OnRunResult |
RunOnAppReady | OnAppReady | OnRun | Listen for OnAppReady and immediately triggers OnRun |
RunTimer | Running | RunTimer | Ticks a timer during a continued run |
TriggerInDuration<T> | RunTimer | T | Triggers T after a Duration |