The EPlaySoundOnEntity event now has support to set the gain on the sound. It now also uses EntityWrapper instead of EntityID.

This commit is contained in:
stiffly
2016-03-03 20:24:48 +01:00
parent 20c6caa408
commit 3613d66d32
5 changed files with 21 additions and 14 deletions
+4 -2
View File
@@ -222,10 +222,12 @@ bool SoundManager::OnPlaySoundOnEntity(const Events::PlaySoundOnEntity & e)
{
Source* source = createSource(e.FilePath);
source->Type = SoundType::SFX;
EntityID child = m_World->CreateEntity(e.EmitterID);
EntityID child = m_World->CreateEntity(e.Emitter.ID);
m_World->AttachComponent(child, "Transform");
m_World->AttachComponent(child, "SoundEmitter");
auto cEmitter = m_World->AttachComponent(child, "SoundEmitter");
(double&)(float)cEmitter["Gain"] = e.Gain;
m_Sources[child] = source;
setGain(source, cEmitter["Gain"]);
playSound(source);
return false;
}