From df82ee88b962a925971c346ddd94cfcdb222f47a Mon Sep 17 00:00:00 2001 From: "arthur.jamet" Date: Thu, 17 Jun 2021 16:50:00 +0200 Subject: [PATCH] timer starts after intro animatio is over --- sources/Runner/GameScene.cpp | 7 ------- sources/System/Renderer/CameraSystem.cpp | 12 ++++++++++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/sources/Runner/GameScene.cpp b/sources/Runner/GameScene.cpp index 69e954fa..84474fd0 100644 --- a/sources/Runner/GameScene.cpp +++ b/sources/Runner/GameScene.cpp @@ -18,7 +18,6 @@ #include "Component/Renderer/Drawable3DComponent.hpp" #include "Component/Renderer/Drawable2DComponent.hpp" #include -#include "Drawables/2D/Text.hpp" #include "Drawables/Texture.hpp" #include "Component/Gravity/GravityComponent.hpp" #include "Component/BumperTimer/BumperTimerComponent.hpp" @@ -38,12 +37,6 @@ namespace BBM scene->addEntity("camera") .addComponent(8, 0, -5) .addComponent(Vector3f(8, 0, 8)); - scene->addEntity("Timer") - .addComponent(std::chrono::minutes (3), [](WAL::Entity &, WAL::Wal &) { - Runner::gameState.nextScene = GameState::ScoreScene; - }) - .addComponent(1920 / 2 - 2 * 30, 30, 0) - .addComponent("", 60, RAY::Vector2(), ORANGE); scene->addEntity("background image") .addComponent(true, "assets/background.png", false) .addComponent(); diff --git a/sources/System/Renderer/CameraSystem.cpp b/sources/System/Renderer/CameraSystem.cpp index 3c4e538c..661eddf2 100644 --- a/sources/System/Renderer/CameraSystem.cpp +++ b/sources/System/Renderer/CameraSystem.cpp @@ -5,6 +5,12 @@ #include "CameraSystem.hpp" #include "Entity/Entity.hpp" #include "Component/Tag/TagComponent.hpp" +#include "Component/Timer/TimerComponent.hpp" +#include "Runner/Runner.hpp" +#include "Component/Renderer/Drawable2DComponent.hpp" +#include "Drawables/2D/Text.hpp" + +namespace RAY2D = RAY::Drawables::Drawables2D; namespace BBM { @@ -53,6 +59,12 @@ namespace BBM } if (playerPos.size() == 0) introAnimation(entity, true); + static auto &timer = this->_wal.getScene()->addEntity("Timer") + .addComponent(std::chrono::minutes (3), [](WAL::Entity &, WAL::Wal &) { + Runner::gameState.nextScene = GameState::ScoreScene; + }) + .addComponent(1920 / 2 - 2 * 30, 30, 0) + .addComponent("", 60, RAY::Vector2(), ORANGE); if (playerPos.size() == 1) newCameraPos = playerPos[0]; for (int i = 0; i < playerPos.size(); i++)