Expand description
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);
Modules§
Macros§
Structs§
- Action
- A simple callback function performed on the actor.
- Conditional
- A simple action performed on the actor.
- Conditional
Decorator - A decorator which only evaluates the child node if the callback function returns
true
. - Node
- A simple callback function performed on the actor.
- Selector
- A composite node which stops evaluating it’s children and returns
BehaviourResult::Success
when a child returnsBehaviourResult::Success
. - Sequence
- A composite node which stops evaluating it’s children and returns
BehaviourResult::Failure
when a child returnsBehaviourResult::Failure
.
Enums§
- Behaviour
Result - The result from a
BehaviourNode
evaluating an actor.
Traits§
- Behaviour
Node - A type which is used to represent a node on the behaviour tree.