mirror of
https://github.com/edubart/otclient.git
synced 2025-12-21 07:57:12 +01:00
emitter delay and system deletion
This commit is contained in:
@@ -35,7 +35,7 @@ bool ParticleManager::load(const std::string& filename)
|
||||
if(node->tag() == "ParticleSystem") {
|
||||
ParticleSystemPtr particleSystem = ParticleSystemPtr(new ParticleSystem);
|
||||
particleSystem->load(node);
|
||||
m_particlesSystems.push_back(particleSystem);
|
||||
m_particleSystems.push_back(particleSystem);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -47,12 +47,21 @@ bool ParticleManager::load(const std::string& filename)
|
||||
|
||||
void ParticleManager::render()
|
||||
{
|
||||
for(auto it = m_particlesSystems.begin(), end = m_particlesSystems.end(); it != end; ++it)
|
||||
for(auto it = m_particleSystems.begin(), end = m_particleSystems.end(); it != end; ++it)
|
||||
(*it)->render();
|
||||
}
|
||||
|
||||
void ParticleManager::update()
|
||||
{
|
||||
for(auto it = m_particlesSystems.begin(), end = m_particlesSystems.end(); it != end; ++it)
|
||||
(*it)->update();
|
||||
for(auto it = m_particleSystems.begin(), end = m_particleSystems.end(); it != end;) {
|
||||
const ParticleSystemPtr& particleSystem = *it;
|
||||
|
||||
if(particleSystem->hasFinished()) {
|
||||
it = m_particleSystems.erase(it);
|
||||
continue;
|
||||
}
|
||||
|
||||
particleSystem->update();
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user