BSelector class
Runs its children in priority order and picks the first one that is
active (returns false from Behavior.process).
Unlike BList (sequence), a selector doesn't wait for a child to finish before trying the next one: every frame it starts from the beginning and runs the first child that needs to keep running.
Useful to express priorities, e.g. "if I see the player, chase them; otherwise patrol":
BSelector(
behaviors: [
BSeeAndMoveToTarget(target: player, onClose: (_, __) {}),
BRandomMovement(),
],
)
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
process(
double dt, GameComponent comp, BonfireGameInterface game) → bool -
Processes this behavior for the current frame.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited