mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-27 16:22:09 +00:00
the player now see the bomb explosion before dying of it
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user