class BehaviorTree::Tree
Root node of the tree. This is the class that must be instantiated by the user.
Constants
- CHILD_VALID_CLASSES
Attributes
context[R]
Public Class Methods
new(child)
click to toggle source
Calls superclass method
BehaviorTree::SingleChildNodeBase::new
# File lib/behavior_tree/tree.rb, line 15 def initialize(child) super(child) if child.nil? # Cannot be leaf, raise error. if CHILD_VALID_CLASSES.any? { |node_class| child.is_a?(NodeBase) && child.chainable_node.is_a?(node_class) } super(child) return end raise InvalidTreeMainNodeError, child.class end
Public Instance Methods
chainable_node()
click to toggle source
# File lib/behavior_tree/tree.rb, line 26 def chainable_node @child end
ensure_after_tick()
click to toggle source
# File lib/behavior_tree/tree.rb, line 30 def ensure_after_tick # Copy the main node status to self. self.status = child.status end