timer starts after intro animatio is over

This commit is contained in:
arthur.jamet
2021-06-17 16:50:00 +02:00
parent 887176c08f
commit df82ee88b9
2 changed files with 12 additions and 7 deletions
-7
View File
@@ -18,7 +18,6 @@
#include "Component/Renderer/Drawable3DComponent.hpp"
#include "Component/Renderer/Drawable2DComponent.hpp"
#include <Drawables/Image.hpp>
#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<PositionComponent>(8, 0, -5)
.addComponent<CameraComponent>(Vector3f(8, 0, 8));
scene->addEntity("Timer")
.addComponent<TimerComponent>(std::chrono::minutes (3), [](WAL::Entity &, WAL::Wal &) {
Runner::gameState.nextScene = GameState::ScoreScene;
})
.addComponent<PositionComponent>(1920 / 2 - 2 * 30, 30, 0)
.addComponent<Drawable2DComponent, RAY2D::Text>("", 60, RAY::Vector2(), ORANGE);
scene->addEntity("background image")
.addComponent<Drawable2DComponent, RAY::Texture>(true, "assets/background.png", false)
.addComponent<PositionComponent>();
+12
View File
@@ -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<TimerComponent>(std::chrono::minutes (3), [](WAL::Entity &, WAL::Wal &) {
Runner::gameState.nextScene = GameState::ScoreScene;
})
.addComponent<PositionComponent>(1920 / 2 - 2 * 30, 30, 0)
.addComponent<Drawable2DComponent, RAY2D::Text>("", 60, RAY::Vector2(), ORANGE);
if (playerPos.size() == 1)
newCameraPos = playerPos[0];
for (int i = 0; i < playerPos.size(); i++)