class BehaviorTree::Selector

A selector node.

Public Instance Methods

on_tick() click to toggle source
# File lib/behavior_tree/control_nodes/selector.rb, line 8
def on_tick
  tick_each_children do |child|
    return status.running! if child.status.running?

    # Both self and children have the status set to success.
    return halt! if child.status.success?
  end

  # Halt, but set success only to children, not to self.
  # Self status must be overriden to failure.
  halt!
  status.failure!
end