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
@@ -87,9 +87,12 @@ void DefenderWeaponBehaviour::fireShell(WeaponInfo& wi)
if (weaponModelEntity.Valid()) {
EntityWrapper spawner = weaponModelEntity.FirstChildByName("WeaponMuzzle");
Events::PlaySoundOnEntity e;
e.EmitterID = weaponModelEntity.ID;
e.Emitter = weaponModelEntity;
e.FilePath = "Audio/weapon/Shotgun/ShotgunFire.wav";
m_EventBroker->Publish(e);
e.Gain = 1.f;
if (IsClient) {
m_EventBroker->Publish(e);
}
for (auto& angles : pelletAngles) {
glm::vec3 direction = Transform::AbsoluteOrientation(spawner) * glm::quat(glm::vec3(angles, 0.f)) * glm::vec3(0, 0, -1);
float distance = traceRayDistance(Transform::AbsolutePosition(spawner), direction);