feat: backlog code

This commit is contained in:
Sara Gerretsen 2026-03-13 10:38:52 +01:00
commit 2a4e00e6f1
16 changed files with 487 additions and 0 deletions

28
behaviour_composite.cpp Normal file
View file

@ -0,0 +1,28 @@
#include "behaviour_composite.h"
void BehaviourComposite::_bind_methods() {}
void BehaviourComposite::child_order_changed() {
this->child_behaviours.clear();
for (Variant var : get_children()) {
if (BehaviourNode * node{ cast_to<BehaviourNode>(var) }) {
this->child_behaviours.push_back(node);
}
}
}
void BehaviourComposite::_notification(int what) {
switch (what) {
default:
return;
case NOTIFICATION_READY:
child_order_changed();
set_leaf(get_child_behaviours().is_empty());
return;
case NOTIFICATION_CHILD_ORDER_CHANGED:
if (is_ready()) {
child_order_changed();
}
return;
}
}