aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/AISystem.cpp
diff options
context:
space:
mode:
authormax-001 <maxsmits21@kpnmail.nl>2024-12-05 17:26:41 +0100
committermax-001 <maxsmits21@kpnmail.nl>2024-12-05 17:26:41 +0100
commite617b4f002638e37dbe4d2ce13849728e7e82c78 (patch)
tree8b3bc87b97623043d07eaa40510454209955f1c9 /src/crepe/system/AISystem.cpp
parent0b942f4d6eb87fb623afbbae617478674c612ccc (diff)
Used Mediator
Diffstat (limited to 'src/crepe/system/AISystem.cpp')
-rw-r--r--src/crepe/system/AISystem.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/crepe/system/AISystem.cpp b/src/crepe/system/AISystem.cpp
index 9029f32..c67d5ea 100644
--- a/src/crepe/system/AISystem.cpp
+++ b/src/crepe/system/AISystem.cpp
@@ -1,6 +1,7 @@
-#include "../ComponentManager.h"
+#include "manager/ComponentManager.h"
#include "api/LoopTimer.h"
#include "api/Transform.h"
+#include "manager/Mediator.h"
#include "types.h"
#include "AISystem.h"
@@ -8,7 +9,8 @@
using namespace crepe;
void AISystem::update() {
- ComponentManager & mgr = this->component_manager;
+ const Mediator & mediator = this->mediator;
+ ComponentManager & mgr = mediator.component_manager;
RefVector<AI> ai_components = mgr.get_components_by_type<AI>();
double dt = LoopTimer::get_instance().get_delta_time();
@@ -63,7 +65,8 @@ bool AISystem::accumulate_force(vec2 & running_total, vec2 force_to_add) {
}
vec2 AISystem::seek(const AI & ai) {
- ComponentManager & mgr = this->component_manager;
+ const Mediator & mediator = this->mediator;
+ ComponentManager & mgr = mediator.component_manager;
RefVector<Transform> transforms = mgr.get_components_by_id<Transform>(ai.game_object_id);
Transform & transform = transforms.front().get();