Added menu music
This commit is contained in:
+1
-1
Submodule assets updated: 33455a9d10...bc6e7df04c
@@ -89,9 +89,9 @@ private:
|
||||
Source* createSource(std::string filePath);
|
||||
std::unordered_map<EntityID, Source*> m_Sources;
|
||||
void matchBGMLoop();
|
||||
Source* m_CurrentBGM;
|
||||
Source* m_CurrentBGMCombo;
|
||||
bool m_TempPleaseDeleteMeASAP = false;
|
||||
Source* m_CurrentBGM = nullptr;
|
||||
Source* m_CurrentBGMCombo = nullptr;
|
||||
bool m_DrumLoopHasBeenStarted = false;
|
||||
|
||||
// Logic
|
||||
World* m_World = nullptr;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "../Engine/Sound/EPlayAnnouncerVoice.h"
|
||||
#include "../Game/Events/EDoubleJump.h"
|
||||
#include "../Game/Events/EDashAbility.h"
|
||||
|
||||
#include "../Engine/Sound/EChangeBGM.h"
|
||||
|
||||
class SoundSystem : public PureSystem, ImpureSystem
|
||||
{
|
||||
|
||||
@@ -30,6 +30,10 @@ SoundManager::SoundManager(World* world, EventBroker* eventBroker)
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &SoundManager::OnPlayerSpawned);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayQueueOnEntity, &SoundManager::OnPlayQueueOnEntity);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EChangeBGM, &SoundManager::OnChangeBGM);
|
||||
|
||||
Events::ChangeBGM e;
|
||||
e.FilePath = "Audio/bgm/MenuMusic.wav";
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
|
||||
SoundManager::~SoundManager()
|
||||
@@ -63,7 +67,7 @@ void SoundManager::Update(double dt)
|
||||
deleteInactiveEmitters();
|
||||
updateEmitters(dt);
|
||||
updateListener(dt);
|
||||
if (m_TempPleaseDeleteMeASAP)
|
||||
if (m_DrumLoopHasBeenStarted)
|
||||
matchBGMLoop();
|
||||
}
|
||||
|
||||
@@ -359,7 +363,7 @@ bool SoundManager::OnPlayerSpawned(const Events::PlayerSpawned &e)
|
||||
{
|
||||
if (e.PlayerID == -1) { // Local player
|
||||
m_LocalPlayer = e.Player;
|
||||
if (m_TempPleaseDeleteMeASAP) {
|
||||
if (m_DrumLoopHasBeenStarted) {
|
||||
return true;
|
||||
}
|
||||
m_CurrentBGMCombo = createSource("Audio/BGM/Layer2.wav");
|
||||
@@ -367,7 +371,7 @@ bool SoundManager::OnPlayerSpawned(const Events::PlayerSpawned &e)
|
||||
alSourcei(m_CurrentBGMCombo->ALsource, AL_LOOPING, 1);
|
||||
setGain(m_CurrentBGMCombo, 0);
|
||||
playSound(m_CurrentBGMCombo);
|
||||
m_TempPleaseDeleteMeASAP = true;
|
||||
m_DrumLoopHasBeenStarted = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -390,10 +394,9 @@ bool SoundManager::OnPlayQueueOnEntity(const Events::PlayQueueOnEntity &e)
|
||||
|
||||
bool SoundManager::OnChangeBGM(const Events::ChangeBGM &e)
|
||||
{
|
||||
if (m_CurrentBGM == nullptr) {
|
||||
return false;
|
||||
if (m_CurrentBGM != nullptr) {
|
||||
stopSound(m_CurrentBGM);
|
||||
}
|
||||
stopSound(m_CurrentBGM);
|
||||
m_CurrentBGM = createSource(e.FilePath);
|
||||
playSound(m_CurrentBGM);
|
||||
return true;
|
||||
|
||||
@@ -30,9 +30,8 @@ bool SoundSystem::OnPlayerSpawned(const Events::PlayerSpawned &e)
|
||||
Events::PlayAnonuncerVoice go;
|
||||
go.FilePath = "Audio/Announcer/" + m_Announcer + "/Go.wav";
|
||||
m_EventBroker->Publish(go);
|
||||
// TEMP: starts bgm
|
||||
{
|
||||
Events::PlayBackgroundMusic ev;
|
||||
Events::ChangeBGM ev;
|
||||
ev.FilePath = "Audio/BGM/Layer1.wav";
|
||||
m_EventBroker->Publish(ev);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user