Bug fix: checked for particles not created
This commit is contained in:
+12
-12
@@ -91,18 +91,18 @@ void GameWorld::Initialize()
|
|||||||
GetSystem<Systems::SoundSystem>("SoundSystem")->PlaySound(emitter);
|
GetSystem<Systems::SoundSystem>("SoundSystem")->PlaySound(emitter);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// {
|
{
|
||||||
// // Particle emitter
|
// Particle emitter
|
||||||
// auto ent = CreateEntity();
|
auto ent = CreateEntity();
|
||||||
// auto transform = AddComponent<Components::Transform>(ent, "Transform");
|
auto transform = AddComponent<Components::Transform>(ent, "Transform");
|
||||||
// transform->Position = glm::vec3(0);
|
transform->Position = glm::vec3(0);
|
||||||
// auto emitter = AddComponent<Components::ParticleEmitter>(ent, "ParticleEmitter");
|
auto emitter = AddComponent<Components::ParticleEmitter>(ent, "ParticleEmitter");
|
||||||
// emitter->LifeTime = 4;
|
emitter->LifeTime = 4;
|
||||||
// emitter->SpawnCount = 3;
|
emitter->SpawnCount = 3;
|
||||||
// emitter->SpreadAngle = 35;
|
emitter->SpreadAngle = 35;
|
||||||
// emitter->SpawnFrequency = 0.3;
|
emitter->SpawnFrequency = 0.3;
|
||||||
// //emitter->
|
//emitter->
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameWorld::Update(double dt)
|
void GameWorld::Update(double dt)
|
||||||
|
|||||||
@@ -28,11 +28,14 @@ void Systems::ParticleSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
SpawnParticles(entity, emitterComponent->SpawnCount, emitterComponent->SpreadAngle);
|
SpawnParticles(entity, emitterComponent->SpawnCount, emitterComponent->SpreadAngle);
|
||||||
m_TimeSinceLastSpawn = 0;
|
m_TimeSinceLastSpawn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout<<m_TimeSinceLastSpawn<<std::endl;
|
std::cout<<m_TimeSinceLastSpawn<<std::endl;
|
||||||
std::list<ParticleData>::iterator it;
|
std::list<ParticleData>::iterator it;
|
||||||
for(it = m_ParticleEmitter[entity].begin(); it == m_ParticleEmitter[entity].end();)
|
for(it = m_ParticleEmitter[entity].begin(); it == m_ParticleEmitter[entity].end();)
|
||||||
{
|
{
|
||||||
auto particleComponent = m_World->GetComponent<Components::Particle>(it->ParticleID, "Particle");
|
auto particleComponent = m_World->GetComponent<Components::Particle>(it->ParticleID, "Particle");
|
||||||
|
if(!particleComponent)
|
||||||
|
break;
|
||||||
|
|
||||||
double timeLived = glfwGetTime() - it->SpawnTime;
|
double timeLived = glfwGetTime() - it->SpawnTime;
|
||||||
std::cout<<timeLived<<std::endl;
|
std::cout<<timeLived<<std::endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user