Made RespawnSystem not spawn while world is paused
This commit is contained in:
@@ -5,10 +5,16 @@ RespawnSystem::RespawnSystem(SystemParams params)
|
||||
, PureSystem("Respawn")
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EEntityDeleted, &RespawnSystem::OnEntityDeleted);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &RespawnSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &RespawnSystem::OnResume);
|
||||
}
|
||||
|
||||
void RespawnSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cRespawn, double dt)
|
||||
{
|
||||
if (m_Paused) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entity.HasComponent("Spawner")) {
|
||||
return;
|
||||
}
|
||||
@@ -30,3 +36,19 @@ bool RespawnSystem::OnEntityDeleted(const Events::EntityDeleted& e)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RespawnSystem::OnPause(const Events::Pause& e)
|
||||
{
|
||||
if (e.World == m_World) {
|
||||
m_Paused = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RespawnSystem::OnResume(const Events::Resume& e)
|
||||
{
|
||||
if (e.World == m_World) {
|
||||
m_Paused = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user