diff --git a/assets/Sounds/BGM/soft-guitar.wav b/assets/Sounds/BGM/eastern-music.wav similarity index 75% rename from assets/Sounds/BGM/soft-guitar.wav rename to assets/Sounds/BGM/eastern-music.wav index a537397..84696e3 100644 Binary files a/assets/Sounds/BGM/soft-guitar.wav and b/assets/Sounds/BGM/eastern-music.wav differ diff --git a/assets/Sounds/BGM/under-the-sea-instrumental.wav b/assets/Sounds/BGM/under-the-sea-n.wav similarity index 74% rename from assets/Sounds/BGM/under-the-sea-instrumental.wav rename to assets/Sounds/BGM/under-the-sea-n.wav index e8d2983..56f1a23 100644 Binary files a/assets/Sounds/BGM/under-the-sea-instrumental.wav and b/assets/Sounds/BGM/under-the-sea-n.wav differ diff --git a/assets/Sounds/GUI/click-n.wav b/assets/Sounds/GUI/click-n.wav new file mode 100644 index 0000000..2460f0b Binary files /dev/null and b/assets/Sounds/GUI/click-n.wav differ diff --git a/assets/Sounds/GUI/click.wav b/assets/Sounds/GUI/click.wav deleted file mode 100644 index cda8f60..0000000 Binary files a/assets/Sounds/GUI/click.wav and /dev/null differ diff --git a/assets/Sounds/GUI/hover-n.wav b/assets/Sounds/GUI/hover-n.wav new file mode 100644 index 0000000..5723639 Binary files /dev/null and b/assets/Sounds/GUI/hover-n.wav differ diff --git a/assets/Sounds/GUI/hover.wav b/assets/Sounds/GUI/hover.wav deleted file mode 100644 index 8d3baef..0000000 Binary files a/assets/Sounds/GUI/hover.wav and /dev/null differ diff --git a/assets/Sounds/screwed.wav b/assets/Sounds/screwed.wav deleted file mode 100644 index 581e755..0000000 Binary files a/assets/Sounds/screwed.wav and /dev/null differ diff --git a/include/GUI/Button.h b/include/GUI/Button.h index e25f8c0..34ae768 100644 --- a/include/GUI/Button.h +++ b/include/GUI/Button.h @@ -76,7 +76,7 @@ protected: e.FrameName = m_Name; EventBroker->Publish(e); Events::PlaySound soundEvent; - soundEvent.FilePath = "Sounds/GUI/hover.wav"; + soundEvent.FilePath = "Sounds/GUI/hover-n.wav"; EventBroker->Publish(soundEvent); } else if (!isOver && m_MouseIsOver) { // Leave diff --git a/include/GUI/Slider.h b/include/GUI/Slider.h index a4987a6..874aadc 100644 --- a/include/GUI/Slider.h +++ b/include/GUI/Slider.h @@ -82,7 +82,7 @@ private: } else { Events::PlaySound e; - e.FilePath = "Sounds/GUI/click.wav"; + e.FilePath = "Sounds/GUI/click-n.wav"; EventBroker->Publish(e); } diff --git a/include/Game/LifebuoySystem.h b/include/Game/LifebuoySystem.h index 21c0378..cfe123b 100644 --- a/include/Game/LifebuoySystem.h +++ b/include/Game/LifebuoySystem.h @@ -5,6 +5,8 @@ #ifndef DAYDREAM_LIFEBUOYSYSTEM_H #define DAYDREAM_LIFEBUOYSYSTEM_H +#include +#include #include "Core/System.h" #include "Core/CTransform.h" #include "Core/CTemplate.h" @@ -19,8 +21,7 @@ #include "Game/ELifebuoy.h" #include "Game/ELifebuoyHit.h" #include "Game/CLifebuoy.h" -#include -#include +#include "Physics/ECreateParticleSequence.h" namespace dd { diff --git a/include/Sound/SoundSystem.h b/include/Sound/SoundSystem.h index 5349258..a369ef2 100644 --- a/include/Sound/SoundSystem.h +++ b/include/Sound/SoundSystem.h @@ -38,6 +38,10 @@ public: void Update(double dt) override; private: + const std::string MENU_BGM = "Sounds/BGM/eastern-music.wav"; + const std::string GAME_BGM = "Sounds/BGM/under-the-sea-n.wav"; + const std::string WATER_BGM = "Sounds/BGM/water-flowing.wav"; + float m_BGMMasterVolume = 1.f; float m_SFXMasterVolume = 1.f; std::map m_BGMSourcesToBuffers; diff --git a/src/game/Game/LifebuoySystem.cpp b/src/game/Game/LifebuoySystem.cpp index db0bd5f..50ae859 100644 --- a/src/game/Game/LifebuoySystem.cpp +++ b/src/game/Game/LifebuoySystem.cpp @@ -132,9 +132,30 @@ bool dd::Systems::LifebuoySystem::OnLifebuoy(const dd::Events::Lifebuoy &event) bool dd::Systems::LifebuoySystem::OnLifebuoyHit(const dd::Events::LifebuoyHit &event) { + auto transformComponent = m_World->GetComponent(event.Lifebuoy); auto lifebuoyComponent = m_World->GetComponent(event.Lifebuoy); lifebuoyComponent->Hits -= 1; auto modelComponent = m_World->GetComponent(event.Lifebuoy); modelComponent->ModelFile = "Models/Lifebuoy/Lifebuoy" + std::to_string(5 - lifebuoyComponent->Hits) + ".obj"; + + Events::CreateParticleSequence e; + e.EmitterLifeTime = 4; + e.EmittingAngle = glm::half_pi(); + e.Spread = 0.5f; + e.NumberOfTicks = 1; + e.ParticleLifeTime = 1.f; + e.ParticlesPerTick = 1; + e.Position = transformComponent->Position; + e.ScaleValues.clear(); + e.ScaleValues.push_back(glm::vec3(0.5f)); + e.ScaleValues.push_back(glm::vec3(2.f, 2.f, 0.2f)); + e.SpriteFile = "Textures/Particles/Cloud_Particle.png"; + e.Color = glm::vec4(1, 0, 0, 1); + e.AlphaValues.clear(); + e.AlphaValues.push_back(1.f); + e.AlphaValues.push_back(0.f); + e.Speed = 10.f; + EventBroker->Publish(e); + return true; } diff --git a/src/game/Sound/SoundSystem.cpp b/src/game/Sound/SoundSystem.cpp index 7580b99..fa1283b 100644 --- a/src/game/Sound/SoundSystem.cpp +++ b/src/game/Sound/SoundSystem.cpp @@ -43,6 +43,13 @@ void dd::Systems::SoundSystem::Initialize() m_SFXMasterVolume = ResourceManager::Load("Config.ini")->GetValue("Audio.SFXVolume", 1.f); m_BGMMasterVolume = ResourceManager::Load("Config.ini")->GetValue("Audio.BGMVolume", 1.f); + + //TODO: Move this + Events::PlaySound e; + e.FilePath = MENU_BGM; + e.IsAmbient = true; + e.Gain = 0.2f; + EventBroker->Publish(e); } void dd::Systems::SoundSystem::Update(double dt) @@ -114,12 +121,13 @@ bool dd::Systems::SoundSystem::OnStopSound(const dd::Events::StopSound &event) { if (item.second->Path() == event.FilePath) { itemToDeleted = item.first; - break; + alSourceStop(itemToDeleted); + alDeleteSources(1, &itemToDeleted); + m_BGMSourcesToBuffers.erase(itemToDeleted); + return true; } } - alSourceStop(itemToDeleted); - alDeleteSources(1, &itemToDeleted); - m_BGMSourcesToBuffers.erase(itemToDeleted); + //Should not happen because SFX's should be very short. for (auto item : m_SFXSourcesToBuffers) @@ -180,15 +188,20 @@ bool dd::Systems::SoundSystem::OnContact(const dd::Events::Contact &event) bool dd::Systems::SoundSystem::OnGameStart(const dd::Events::GameStart &event) { + { + dd::Events::StopSound e; + e.FilePath = MENU_BGM; + EventBroker->Publish(e); + } { dd::Events::PlaySound e; - e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav"; + e.FilePath = GAME_BGM; e.IsAmbient = true; EventBroker->Publish(e); } { dd::Events::PlaySound e; - e.FilePath = "Sounds/BGM/water-flowing.wav"; + e.FilePath = WATER_BGM; e.Gain = 0.3f; e.IsAmbient = true; EventBroker->Publish(e);