Swoosh sound when passing close to obstacles

This commit is contained in:
2015-06-01 23:26:59 +02:00
parent 8bd3ccf4cf
commit b81d60799e
5 changed files with 83 additions and 54 deletions
+15 -1
View File
@@ -62,7 +62,7 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa
}
}
LOG_DEBUG("Constant: %f\nLinear: %f\nQuadratic: %f", light->constantAttenuation, light->linearAttenuation, light->quadraticAttenuation);
//LOG_DEBUG("Constant: %f\nLinear: %f\nQuadratic: %f", light->constantAttenuation, light->linearAttenuation, light->quadraticAttenuation);
}
if (name == "Camera") {
@@ -198,6 +198,20 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa
{
m_World->RemoveEntity(entity);
}
if (m_World->GetProperty<std::string>(ent, "Name") == "Obstacle_SoundTrigger")
{
auto parent = m_World->GetEntityParent(ent);
auto swoosh = m_World->CreateEntity(parent);
m_World->AddComponent<Components::Transform>(swoosh, "Transform");
auto swooshSound = m_World->AddComponent<Components::SoundEmitter>(swoosh, "SoundEmitter");
swooshSound->Gain = 2.f;
swooshSound->MaxDistance = 5.f;
swooshSound->ReferenceDistance = 1.f;
auto soundSystem = m_World->GetSystem<Systems::SoundSystem>("SoundSystem");
soundSystem->PlaySound(swooshSound.get(), "Sounds/swoosh.wav");
m_World->RemoveEntity(ent);
}
}
//powerup