From a556b45abf18f1bd509daaf63b66b7d55e9fd291 Mon Sep 17 00:00:00 2001 From: jjesswan Date: Mon, 22 Apr 2024 21:56:26 -0400 Subject: add engine version --- engine-ocean/Game/Systems/AI/btselector.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 engine-ocean/Game/Systems/AI/btselector.cpp (limited to 'engine-ocean/Game/Systems/AI/btselector.cpp') diff --git a/engine-ocean/Game/Systems/AI/btselector.cpp b/engine-ocean/Game/Systems/AI/btselector.cpp new file mode 100644 index 0000000..9652838 --- /dev/null +++ b/engine-ocean/Game/Systems/AI/btselector.cpp @@ -0,0 +1,29 @@ +#include "btselector.h" +#include + +BTSelector::BTSelector() +{ + +} + +void BTSelector::addChildren(BTNode* node){ + m_children.push_back(node); +} + +Status BTSelector::update(float seconds){ + // update each children until one doesnt fail + for (auto node : m_children){ + Status result = node->update(seconds); + + // select this one and return its status --> this node is currently running + if (result != Status::FAIL){ + m_selected_node = node; + return result; + } + } + + // otherwise if all children fail, then fail this selector + return Status::FAIL; +} + +void BTSelector::reset(){} -- cgit v1.2.3-70-g09d2