aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/crepe/system/AISystem.cpp9
-rw-r--r--src/example/AITest.cpp6
2 files changed, 10 insertions, 5 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();
diff --git a/src/example/AITest.cpp b/src/example/AITest.cpp
index 341e1de..71aacb2 100644
--- a/src/example/AITest.cpp
+++ b/src/example/AITest.cpp
@@ -1,6 +1,7 @@
+#include <crepe/manager/Mediator.h>
#include <SDL2/SDL_timer.h>
#include <chrono>
-#include <crepe/ComponentManager.h>
+#include <crepe/manager/ComponentManager.h>
#include <crepe/api/AI.h>
#include <crepe/api/Camera.h>
#include <crepe/api/Color.h>
@@ -16,7 +17,8 @@ using namespace std;
class Scene1 : public Scene {
public:
void load_scene() override {
- ComponentManager & mgr = this->component_manager;
+ Mediator & mediator = this->mediator;
+ ComponentManager & mgr = mediator.component_manager;
GameObject game_object1 = mgr.new_object("", "", vec2{250, 250}, 0, 1);
GameObject game_object2 = mgr.new_object("", "", vec2{0, 0}, 0, 1);