Merge remote-tracking branch 'origin' into Tobias
This commit is contained in:
@@ -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<Components::Transform>(event.Lifebuoy);
|
||||
auto lifebuoyComponent = m_World->GetComponent<Components::Lifebuoy>(event.Lifebuoy);
|
||||
lifebuoyComponent->Hits -= 1;
|
||||
auto modelComponent = m_World->GetComponent<Components::Model>(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<float>();
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,13 @@ void dd::Systems::SoundSystem::Initialize()
|
||||
|
||||
m_SFXMasterVolume = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<float>("Audio.SFXVolume", 1.f);
|
||||
m_BGMMasterVolume = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<float>("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);
|
||||
|
||||
Reference in New Issue
Block a user