the player now see the bomb explosion before dying of it

This commit is contained in:
HENRY Benjamin
2021-06-17 14:34:29 +02:00
parent 933a96c449
commit 4e306581de
13 changed files with 27 additions and 16 deletions
@@ -11,7 +11,7 @@ namespace BBM
: System(wal)
{}
void EndConditionSystem::onSelfUpdate()
void EndConditionSystem::onSelfUpdate(std::chrono::nanoseconds dtime)
{
unsigned int alivePlayersCount = 0;
auto &view = this->_wal.getScene()->view<ScoreComponent, HealthComponent>();
@@ -20,7 +20,12 @@ namespace BBM
return;
for (auto &[_, scoreComponent, healthComponent]: view)
alivePlayersCount += (healthComponent.getHealthPoint() != 0);
if (alivePlayersCount <= 1)
Runner::gameState.nextScene = Runner::gameState.ScoreScene;
if (alivePlayersCount <= 1) {
endConditionRate -= dtime;
if (endConditionRate <= 0ns) {
Runner::gameState.nextScene = Runner::gameState.ScoreScene;
endConditionRate = 500ms;
}
}
}
}