WIP
This commit is contained in:
@@ -14,9 +14,6 @@ SoundManager::SoundManager(World* world, EventBroker* eventBroker)
|
||||
alDistanceModel(AL_LINEAR_DISTANCE);
|
||||
alDopplerFactor(1);
|
||||
|
||||
//m_CurrentBGM = createSource("Audio/lalala.wav");
|
||||
//playSound(m_CurrentBGM);
|
||||
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlaySoundOnEntity, &SoundManager::OnPlaySoundOnEntity);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlaySoundOnPosition, &SoundManager::OnPlaySoundOnPosition);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayBackgroundMusic, &SoundManager::OnPlayBackgroundMusic);
|
||||
@@ -122,7 +119,7 @@ void SoundManager::updateEmitters(double dt)
|
||||
// Calculate velocity
|
||||
glm::vec3 velocity = glm::vec3(nextPos - previousPos) / (float)dt;
|
||||
setSourcePos(it->second->ALsource, nextPos);
|
||||
setSourceVel(it->second->ALsource, glm::vec3(0));
|
||||
//setSourceVel(it->second->ALsource, glm::vec3(0));
|
||||
|
||||
auto emitter = m_World->GetComponent(it->first, "SoundEmitter");
|
||||
setSoundProperties(it->second, &emitter);
|
||||
|
||||
@@ -20,11 +20,7 @@ void SoundSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cComp
|
||||
{ }
|
||||
|
||||
void SoundSystem::Update(double dt)
|
||||
{
|
||||
if (!IsClient) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
{ }
|
||||
|
||||
bool SoundSystem::OnPlayerSpawned(const Events::PlayerSpawned &e)
|
||||
{
|
||||
@@ -51,26 +47,12 @@ bool SoundSystem::OnInputCommand(const Events::InputCommand & e)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (e.Command == "SoundTemp" && e.Value > 0) {
|
||||
EntityWrapper entity(m_World, m_World->CreateEntity());
|
||||
auto transform = m_World->AttachComponent(entity.ID, "Transform");
|
||||
(glm::vec3&)transform["Position"] = glm::vec3(0, 10, 0);
|
||||
(glm::vec3&)transform["Scale"] = glm::vec3(10, 10, 10);
|
||||
auto emitter = m_World->AttachComponent(entity.ID, "SoundEmitter");
|
||||
auto model = m_World->AttachComponent(entity.ID, "Model");
|
||||
(std::string&)model["Resource"] = "Models/Core/UnitCube.mesh";
|
||||
Events::PlaySoundOnEntity ev;
|
||||
ev.Emitter = entity;
|
||||
ev.FilePath = "Audio/crosscounter.wav";
|
||||
m_EventBroker->Publish(ev);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void SoundSystem::playerJumps()
|
||||
{
|
||||
if (!LocalPlayer.Valid()) {
|
||||
if (!IsClient) { // Only play for clients
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -85,7 +67,7 @@ void SoundSystem::playerJumps()
|
||||
|
||||
bool SoundSystem::OnCaptured(const Events::Captured & e)
|
||||
{
|
||||
if (!LocalPlayer.Valid()) {
|
||||
if (!IsClient) { // Only play for clients
|
||||
return false;
|
||||
}
|
||||
int homeTeam = (int)m_World->GetComponent(e.CapturePointTakenID, "Team")["Team"];
|
||||
|
||||
Reference in New Issue
Block a user