aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/api/Script.cpp')
-rw-r--r--src/crepe/api/Script.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/crepe/api/Script.cpp b/src/crepe/api/Script.cpp
index fcbe4c7..4091fd4 100644
--- a/src/crepe/api/Script.cpp
+++ b/src/crepe/api/Script.cpp
@@ -1,11 +1,17 @@
+#include <string>
+
+#include "../manager/SceneManager.h"
+
#include "Script.h"
using namespace crepe;
+using namespace std;
Script::~Script() {
- EventManager & evmgr = this->event_manager;
+ Mediator & mediator = this->mediator;
+ EventManager & mgr = mediator.event_manager;
for (auto id : this->listeners) {
- evmgr.unsubscribe(id);
+ mgr.unsubscribe(id);
}
}
@@ -13,3 +19,9 @@ template <>
void Script::subscribe(const EventHandler<CollisionEvent> & callback) {
this->subscribe_internal(callback, this->game_object_id);
}
+
+void Script::set_next_scene(const string & name) {
+ Mediator & mediator = this->mediator;
+ SceneManager & mgr = mediator.scene_manager;
+ mgr.set_next_scene(name);
+}