add time component

This commit is contained in:
arthur.jamet
2021-06-15 10:53:59 +02:00
parent 0bc65f2ffd
commit a2a686cdc7
3 changed files with 7 additions and 1 deletions
+1
View File
@@ -26,6 +26,7 @@ namespace BBM
LobbyScene,
TitleScreenScene,
CreditScene,
ScoreScene = MainMenuScene,
};
+5
View File
@@ -22,6 +22,7 @@
#include "Drawables/2D/Text.hpp"
#include "Component/Gravity/GravityComponent.hpp"
#include "Component/BumperTimer/BumperTimerComponent.hpp"
#include "Component/Timer/TimerComponent.hpp"
#include "Model/Model.hpp"
#include "Map/Map.hpp"
#include "Component/Score/ScoreComponent.hpp"
@@ -42,6 +43,10 @@ namespace BBM
{SoundComponent::BOMB, "assets/sounds/bomb_drop.ogg"},
//{SoundComponent::DEATH, "assets/sounds/death.ogg"}
};
scene->addEntity("Timer")
.addComponent<TimerComponent>(std::chrono::seconds(60), [](WAL::Entity &, WAL::Wal &) {
Runner::gameState.nextScene = GameState::ScoreScene;
});
scene->addEntity("player")
.addComponent<PositionComponent>(0, 1.01, 0)
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/player/player.iqm", true, std::make_pair(MAP_DIFFUSE, "assets/player/blue.png"))
@@ -16,6 +16,6 @@ namespace BBM {
for (auto & [_ , healthComponent]: this->_wal.getScene()->view<HealthComponent>())
alivePlayersCount += (healthComponent.getHealthPoint() != 0);
if (alivePlayersCount <= 1)
Runner::gameState.nextScene = Runner::gameState.MainMenuScene;
Runner::gameState.nextScene = Runner::gameState.ScoreScene;
}
}