Crate beehave [−] [src]
A simple library for defining and evaluating behaviour trees on an actor.
Building A Behaviour Tree
let world_behaviour: Selector<World> = behaviour_selector!("World Root", [ condition_decorator!("Ensure Can Shine", |world: &mut World| { world.can_shine() }, action!("Cycle Day/Night", |world: &mut World| { world.toggle_sun() }) ), condition_decorator!("Ensure Can Rain", |world: &mut World| { world.can_rain() }, action!("Rain", |world: &mut World| { world.rain() }) ) ]);
Evaluating A Behaviour Tree
world_behaviour.evaluate(&mut world);
Macros
action | |
behaviour_selector | |
behaviour_sequence | |
condition | |
condition_decorator | |
node |
Structs
Action |
A simple callback function performed on the actor. |
Conditional |
A simple action performed on the actor. |
ConditionalDecorator |
A decorator which only evaluates the child node if the callback function returns |
Node |
A simple callback function performed on the actor. |
Selector |
A composite node which stops evaluating it's children and returns |
Sequence |
A composite node which stops evaluating it's children and returns |
Enums
BehaviourResult |
The result from a |
Traits
BehaviourNode |
A type which is used to represent a node on the behaviour tree. |