pub struct BehaviorTree { /* private fields */ }Expand description
Data-driven arena-indexed Behavior Tree supporting composites, decorators, conditions, and actions.
Implementations§
Source§impl BehaviorTree
Tree construction, reset, and tick execution for BehaviorTree.
impl BehaviorTree
Tree construction, reset, and tick execution for BehaviorTree.
Sourcepub fn add_node(&mut self, kind: BtNodeKind) -> usize
pub fn add_node(&mut self, kind: BtNodeKind) -> usize
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Resets running child offsets, repeat counters, and active cooldowns across all nodes.
Sourcepub fn tick<C, A>(
&mut self,
dt: f32,
blackboard: &mut Blackboard,
eval_condition: C,
run_action: A,
) -> BtStatus
pub fn tick<C, A>( &mut self, dt: f32, blackboard: &mut Blackboard, eval_condition: C, run_action: A, ) -> BtStatus
Advances cooldown timers by dt and executes the tree from root with zero heap allocations.
§Arguments
f32- Delta time in seconds (clamped to>= 0.0).&mut Blackboard- Shared typed blackboard.C- Condition evaluator callback.A- Action executor callback.
§Returns
BtStatus- Root evaluation status for this tick.
Source§impl BehaviorTree
Implements impl #impl_generics #name #ty_generics #where_clause.
impl BehaviorTree
Implements impl #impl_generics #name #ty_generics #where_clause.
pub fn get_nodes(&self) -> &Vec<BtNodeKind>
pub fn get_mut_nodes(&mut self) -> &mut Vec<BtNodeKind>
pub fn set_nodes(&mut self, val: Vec<BtNodeKind>) -> &mut Self
pub fn get_root(&self) -> usize
pub fn get_mut_root(&mut self) -> &mut usize
pub fn set_root(&mut self, val: usize) -> &mut Self
Trait Implementations§
Source§impl Clone for BehaviorTree
impl Clone for BehaviorTree
Source§impl Debug for BehaviorTree
impl Debug for BehaviorTree
Auto Trait Implementations§
impl Forget for BehaviorTree
impl Freeze for BehaviorTreewhere
*const u8 is !null: Freeze,
PhantomData<BtNodeKind>: Freeze,
PhantomData<BtNodeState>: Freeze,
impl Move for BehaviorTree
impl RefUnwindSafe for BehaviorTree
impl Send for BehaviorTreewhere
RawVecInner: Send,
impl Sync for BehaviorTreewhere
RawVecInner: Sync,
impl Unpin for BehaviorTree
impl UnsafeUnpin for BehaviorTreewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<BtNodeKind>: UnsafeUnpin,
PhantomData<BtNodeState>: UnsafeUnpin,
impl UnwindSafe for BehaviorTreewhere
RawVecInner: UnwindSafe,
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