Struct aspen::BehaviorTree [] [src]

pub struct BehaviorTree { /* fields omitted */ }

Main behavior tree struct.

A behavior tree is considered to have been run to completion when it returns either Status::Succeeded or Status::Failed when ticked. Unlike a Node, the BehaviorTree will not automatically reset itself when ticked. Instead, ticking or running a completed behavior tree will just return the value of the last tick - it must be explicitly reset.

Methods

impl BehaviorTree
[src]

Create a new behavior tree with the supplied Node as the root.

impl BehaviorTree
[src]

Returns a reference to the root node.

Tick the behavior tree a single time.

If the tree has already been run to completion, this will simply return the value of the last tick.

Reset the tree so that it can be run again.

Run the behavior tree until it either succeeds or fails.

This makes no guarantees that it will run at the specified frequency. If a single tick takes longer than the alloted tick time, then it will do so silently.

If the hook is supplied, it will be run after every tick. A reference to this behavior tree will be supplied as an argument.

NOTE: The only time this will return Status::Running is if the frequency is zero and the behavior tree is running after the first tick.

Trait Implementations

impl Display for BehaviorTree
[src]

Formats the value using the given formatter. Read more