aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/AISystem.cpp
diff options
context:
space:
mode:
authormax-001 <maxsmits21@kpnmail.nl>2024-12-04 13:46:41 +0100
committermax-001 <maxsmits21@kpnmail.nl>2024-12-04 13:46:41 +0100
commitf9f5600b60d6944dc9a7dd502988703d59d0cd62 (patch)
tree4f6d7cfe7e15bf0fd3b838769cb2a093de487ba6 /src/crepe/system/AISystem.cpp
parentac87bfad20e1bcf1fd066a4eda231608fe12f504 (diff)
Setup some behaviors
Diffstat (limited to 'src/crepe/system/AISystem.cpp')
-rw-r--r--src/crepe/system/AISystem.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/crepe/system/AISystem.cpp b/src/crepe/system/AISystem.cpp
index 012f4fa..12da3d9 100644
--- a/src/crepe/system/AISystem.cpp
+++ b/src/crepe/system/AISystem.cpp
@@ -1,6 +1,34 @@
+#include "../ComponentManager.h"
+
#include "AISystem.h"
-#include <iostream>
using namespace crepe;
-void AISystem::update() { std::cout << "AI System update" << std::endl; }
+void AISystem::update() {
+ ComponentManager & mgr = this->component_manager;
+ RefVector<AI> ai_components = mgr.get_components_by_type<AI>();
+
+ for (AI & ai : ai_components) {
+ vec2 force = this->calculate(ai);
+ //...
+ }
+}
+
+vec2 AISystem::calculate(AI & ai) {
+ vec2 force;
+
+ if (ai.on(AI::BehaviorType::SEEK)) {
+ // Seek the target
+ }
+ if (ai.on(AI::BehaviorType::FLEE)) {
+ // Flee from the target
+ }
+ if (ai.on(AI::BehaviorType::ARRIVE)) {
+ // Arrive at the target
+ }
+ if (ai.on(AI::BehaviorType::PATH_FOLLOW)) {
+ // Follow the path
+ }
+
+ return force;
+}