From cc10e5500b6ced786c9b4d2ceeb4976a7218564c Mon Sep 17 00:00:00 2001 From: stiffly Date: Sat, 12 Mar 2016 15:31:44 +0100 Subject: [PATCH] 2x jump now only plays for local player --- src/Engine/Sound/SoundManager.cpp | 2 +- src/Game/Systems/SoundSystem.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Engine/Sound/SoundManager.cpp b/src/Engine/Sound/SoundManager.cpp index 83619ea9..2495fdd6 100644 --- a/src/Engine/Sound/SoundManager.cpp +++ b/src/Engine/Sound/SoundManager.cpp @@ -275,7 +275,7 @@ bool SoundManager::OnPlayBackgroundMusic(const Events::PlayBackgroundMusic & e) auto listenerComponents = m_World->GetComponents("Listener"); for (auto it = listenerComponents->begin(); it != listenerComponents->end(); it++) { if ((*it).EntityID != m_LocalPlayer.ID) { - continue;; + continue; } auto emitterChild = m_World->CreateEntity((*it).EntityID); auto emitter = m_World->AttachComponent(emitterChild, "SoundEmitter"); diff --git a/src/Game/Systems/SoundSystem.cpp b/src/Game/Systems/SoundSystem.cpp index ef61b070..f486c28c 100644 --- a/src/Game/Systems/SoundSystem.cpp +++ b/src/Game/Systems/SoundSystem.cpp @@ -145,9 +145,11 @@ bool SoundSystem::OnDoubleJump(const Events::DoubleJump & e) if (!IsClient) { return false; } - //Events::PlaySoundOnEntity ev; - //ev.Emitter = EntityWrapper(m_World, e.entityID); - //ev.FilePath = "Audio/Jump/Jump2.wav"; - //m_EventBroker->Publish(ev); + if (e.entityID == LocalPlayer.ID) { + Events::PlaySoundOnEntity ev; + ev.Emitter = EntityWrapper(m_World, e.entityID); + ev.FilePath = "Audio/Jump/Jump2.wav"; + m_EventBroker->Publish(ev); + } return false; } \ No newline at end of file