Merge remote-tracking branch 'origin/master' into Sound
# Conflicts: # assets
This commit is contained in:
+1
-1
Submodule assets updated: 29f8e12346...a738763092
@@ -35,6 +35,7 @@
|
||||
#include "Core/EEntityDeleted.h"
|
||||
#include "Collision/ETrigger.h"
|
||||
#include "Core/EPause.h"
|
||||
#include "Game/Events/EDoubleJump.h"
|
||||
|
||||
|
||||
typedef std::pair<ALuint, std::vector<ALuint>> QueuedBuffers;
|
||||
@@ -152,6 +153,8 @@ private:
|
||||
bool OnPause(const Events::Pause &e);
|
||||
EventRelay<SoundSystem, Events::Resume> m_EResume;
|
||||
bool OnResume(const Events::Resume &e);
|
||||
EventRelay<SoundSystem, Events::DoubleJump> m_EDoubleJump;
|
||||
bool OnDoubleJump(const Events::DoubleJump &e);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef Events_DoubleJump_h__
|
||||
#define Events_DoubleJump_h__
|
||||
|
||||
#include "Core/Event.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct DoubleJump : public Event
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Core/EPlayerSpawned.h"
|
||||
#include "Input/FirstPersonInputController.h"
|
||||
#include <imgui/imgui.h>
|
||||
#include "Events/EDoubleJump.h"
|
||||
|
||||
class PlayerMovementSystem : public ImpureSystem, PureSystem
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ SoundSystem::SoundSystem(World* world, EventBroker* eventBroker, bool editorMode
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &SoundSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &SoundSystem::OnResume);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EComponentAttached, &SoundSystem::OnComponentAttached);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &SoundSystem::OnDoubleJump);
|
||||
}
|
||||
|
||||
SoundSystem::~SoundSystem()
|
||||
@@ -400,7 +401,6 @@ bool SoundSystem::OnPlayerDamage(const Events::PlayerDamage & e)
|
||||
Source* source = createSource("Audio/hurt/hurt" + std::to_string(rand) + ".wav");
|
||||
source->Type = SoundType::SFX;
|
||||
m_Sources[child] = source;
|
||||
//playSound(source);
|
||||
|
||||
// breathe
|
||||
std::vector<ALuint> buffers;
|
||||
@@ -486,6 +486,18 @@ bool SoundSystem::OnResume(const Events::Resume &e)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SoundSystem::OnDoubleJump(const Events::DoubleJump & e)
|
||||
{
|
||||
Events::PlaySoundOnEntity ev;
|
||||
EntityID child = m_World->CreateEntity(m_LocalPlayer);
|
||||
m_World->AttachComponent(child, "Transform");
|
||||
m_World->AttachComponent(child, "SoundEmitter");
|
||||
ev.EmitterID = child;
|
||||
ev.FilePath = "Audio/jump/jump2.wav";
|
||||
m_EventBroker->Publish(ev);
|
||||
return false;
|
||||
}
|
||||
|
||||
void SoundSystem::setListenerOri(glm::vec3 ori)
|
||||
{
|
||||
// Calculate forward and up vector.
|
||||
|
||||
@@ -82,6 +82,8 @@ void PlayerMovementSystem::Update(double dt)
|
||||
}
|
||||
else {
|
||||
controller->SetDoubleJumping(true);
|
||||
Events::DoubleJump e;
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
velocity.y += 4.f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user