Added entity SpectatorCamera that shows respawntime, will activate when explosion effect is deleted.

This commit is contained in:
William Moberg
2016-03-01 17:32:14 +01:00
parent 5c6a652316
commit 3d4427dd20
6 changed files with 5438 additions and 0 deletions
+12
View File
@@ -27,6 +27,18 @@ void PlayerSpawnSystem::Update(double dt)
double& timer = (double&)modeComponent["RespawnTime"];
timer += dt;
double maxRespawnTime = m_DbgConfigForceRespawn ? m_ForcedRespawnTime : (double)modeComponent["MaxRespawnTime"];
EntityWrapper theLevel = EntityWrapper(m_World, modeComponent.EntityID);
EntityWrapper spectatorCam = theLevel.FirstChildByName("SpectatorCamera");
if (spectatorCam.Valid()) {
EntityWrapper HUD = spectatorCam.FirstChildByName("SpectatorHUD");
if (HUD.Valid()) {
EntityWrapper respawnTimer = spectatorCam.FirstChildByName("RespawnTimer");
if (respawnTimer.Valid()) {
//Update respawn time in the HUD element.
respawnTimer["Text"]["Content"] = "Time to respawn: " + std::to_string(1 + (int)(maxRespawnTime - timer));
}
}
}
if (timer < maxRespawnTime) {
return;
}