pub trait BehaviorInterpreter {
// Required method
fn tick(
&mut self,
ctx: &mut BehaviorContext<'_>,
) -> Result<BehaviorStatus, BehaviorError>;
}Expand description
A behavior executor: something the Arora runtime ticks once per step to run an authored behavior.
Implemented by the behavior tree (arora-behavior-tree’s
[BehaviorTreeInterpreter]) and by other interpreters such as a Vizij
node-graph interpreter. The runtime holds a queue of
Box<dyn BehaviorInterpreter> and ticks them without knowing which is which.
Implement this to add a new kind of executor (a new authored-behavior representation the runtime can run), not to hand-code one particular behavior — authored behaviors come from the visual editors, run by an existing interpreter.
Not Send: the runtime is a single-owner, single-thread step loop.
Required Methods§
Sourcefn tick(
&mut self,
ctx: &mut BehaviorContext<'_>,
) -> Result<BehaviorStatus, BehaviorError>
fn tick( &mut self, ctx: &mut BehaviorContext<'_>, ) -> Result<BehaviorStatus, BehaviorError>
Advance one step. Return BehaviorStatus::Running to be ticked again,
or BehaviorStatus::Done to be dropped.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".