When using a PlaySoundOnEntity Event, you no longer have to provide the child of an entity as parameter.

This commit is contained in:
stiffly
2016-02-10 11:04:18 +01:00
parent 2c64ffc3d1
commit 94ff12cf66
5 changed files with 15 additions and 26 deletions
+5 -2
View File
@@ -192,7 +192,10 @@ bool SoundManager::OnPlaySoundOnEntity(const Events::PlaySoundOnEntity & e)
{
Source* source = createSource(e.FilePath);
source->Type = SoundType::SFX;
m_Sources[e.EmitterID] = source;
EntityID child = m_World->CreateEntity(e.EmitterID);
m_World->AttachComponent(child, "Transform");
m_World->AttachComponent(child, "SoundEmitter");
m_Sources[child] = source;
playSound(source);
return false;
}
@@ -243,7 +246,7 @@ bool SoundManager::OnPlayBackgroundMusic(const Events::PlayBackgroundMusic & e)
}
auto emitterChild = m_World->CreateEntity((*it).EntityID);
auto emitter = m_World->AttachComponent(emitterChild, "SoundEmitter");
(bool&)emitter["Loop"] = false;
(bool&)emitter["Loop"] = true;
(std::string&)emitter["FilePath"] = e.FilePath;
m_World->AttachComponent(emitterChild, "Transform");
Source* source = createSource(e.FilePath);