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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user