pub struct BehaviorTree { /* private fields */ }Expand description
A behavior tree with a root node and shared context.
Implementations§
Source§impl BehaviorTree
impl BehaviorTree
Sourcepub fn new(root: BehaviorNode) -> Self
pub fn new(root: BehaviorNode) -> Self
Create a new tree with the given root node.
Sourcepub fn tick(&mut self) -> BehaviorStatus
pub fn tick(&mut self) -> BehaviorStatus
Tick the tree once, returning the root status.
Sourcepub fn set_condition(&mut self, name: &str, value: bool)
pub fn set_condition(&mut self, name: &str, value: bool)
Set a named boolean condition.
Sourcepub fn set_action_result(&mut self, name: &str, status: BehaviorStatus)
pub fn set_action_result(&mut self, name: &str, status: BehaviorStatus)
Set the result that a named action should return.
Sourcepub fn context(&self) -> &BehaviorContext
pub fn context(&self) -> &BehaviorContext
Read-only access to the context.
Sourcepub fn root(&self) -> &BehaviorNode
pub fn root(&self) -> &BehaviorNode
Read-only reference to the root node.
Trait Implementations§
Source§impl Clone for BehaviorTree
impl Clone for BehaviorTree
Source§fn clone(&self) -> BehaviorTree
fn clone(&self) -> BehaviorTree
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BehaviorTree
impl RefUnwindSafe for BehaviorTree
impl Send for BehaviorTree
impl Sync for BehaviorTree
impl Unpin for BehaviorTree
impl UnsafeUnpin for BehaviorTree
impl UnwindSafe for BehaviorTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more