diff --git a/behaviour_tree.cpp b/behaviour_tree.cpp index 7268f749cf..7b36bc5cbc 100644 --- a/behaviour_tree.cpp +++ b/behaviour_tree.cpp @@ -1,11 +1,14 @@ #include "behaviour_tree.h" #include "behaviour_nodes/behaviour_composite.h" #include "behaviour_nodes/behaviour_node.h" -#include "behaviour_nodes/control_nodes.h" #include "core/config/engine.h" +#include "core/object/class_db.h" +#include "core/object/object.h" #include "core/variant/typed_array.h" -void BehaviourTree::_bind_methods() {} +void BehaviourTree::_bind_methods() { + ADD_SIGNAL(MethodInfo("current_behaviour_changed", PropertyInfo(Variant::OBJECT, "new_behaviour", PROPERTY_HINT_NODE_TYPE, "BehaviourNode"))); +} void BehaviourTree::process() { do { @@ -47,6 +50,7 @@ bool BehaviourTree::execute_next() { } if (this->current->get_parent() != next) { next->enter(); + emit_signal("current_behaviour_changed", next); } this->current = next; return this->current != this->root && (cast_to(this->current) || this->current->get_status() != BehaviourNode::Running);