Merge remote-tracking branch 'origin' into Tobias

This commit is contained in:
tleety
2015-10-19 15:57:41 +02:00
13 changed files with 49 additions and 10 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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);
}
+3 -2
View File
@@ -5,6 +5,8 @@
#ifndef DAYDREAM_LIFEBUOYSYSTEM_H
#define DAYDREAM_LIFEBUOYSYSTEM_H
#include <fstream>
#include <iostream>
#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 <fstream>
#include <iostream>
#include "Physics/ECreateParticleSequence.h"
namespace dd
{
+4
View File
@@ -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<ALuint, Sound*> m_BGMSourcesToBuffers;
+21
View File
@@ -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;
}
+19 -6
View File
@@ -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);