From 7f017bfaed19c9510a42c53ccdb79450ef4ee76e Mon Sep 17 00:00:00 2001 From: Stiffly Date: Wed, 4 Jun 2014 04:40:16 +0200 Subject: [PATCH] Tanks now have listeners. --- assets | 2 +- src/Systems/TankSteeringSystem.cpp | 21 +++++++++++---------- src/Systems/TankSteeringSystem.h | 1 + 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/assets b/assets index 78ba667..a6e3f12 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 78ba667b37a553c8387bc2717032c284dbd14aa9 +Subproject commit a6e3f120fd90e4c2c3983cf0098bb9c3ebdc4b39 diff --git a/src/Systems/TankSteeringSystem.cpp b/src/Systems/TankSteeringSystem.cpp index 88d05a3..312eafc 100644 --- a/src/Systems/TankSteeringSystem.cpp +++ b/src/Systems/TankSteeringSystem.cpp @@ -126,11 +126,11 @@ void Systems::TankSteeringSystem::UpdateEntity(double dt, EntityID entity, Entit } { -// Events::PlaySFX e; -// e.Resource = "Sounds/SFX/TankShot.mp3"; -// e.Position = absoluteTransform.Position; -// e.Loop = false; -// EventBroker->Publish(e); + Events::PlaySFX e; + e.Resource = "Sounds/SFX/TankShot.mp3"; + e.Position = cloneTransform->Position; + e.Loop = false; + EventBroker->Publish(e); } auto clonePhysicsComponent = m_World->GetComponent(clone); @@ -225,11 +225,11 @@ bool Systems::TankSteeringSystem::OnCollision(const Events::Collision &e) EventBroker->Publish(e); } { -// Events::PlaySFX e; -// e.MinDistance = 150.f; -// e.Position = shellTransform->Position; -// e.Resource = "Sounds/SFX/Explosion.wav"; -// EventBroker->Publish(e); + Events::PlaySFX e; + e.MinDistance = 150.f; + e.Position = shellTransform->Position; + e.Resource = "Sounds/SFX/Explosion.wav"; + EventBroker->Publish(e); } for (auto &physComponent : *physicsComponents) @@ -399,6 +399,7 @@ EntityID Systems::TankSteeringSystem::CreateTank(int playerID) m_World->AddComponent(tank); auto health = m_World->AddComponent(tank); health->Amount = 100.f; + m_World->AddComponent(tank); { auto shape = m_World->CreateEntity(tank); diff --git a/src/Systems/TankSteeringSystem.h b/src/Systems/TankSteeringSystem.h index 7035825..3f2ee51 100644 --- a/src/Systems/TankSteeringSystem.h +++ b/src/Systems/TankSteeringSystem.h @@ -22,6 +22,7 @@ #include "Components/Health.h" #include "Components/TankShell.h" #include "Components/SphereShape.h" +#include "Components/Listener.h" #include "Events/EnableCollisions.h" #include "Events/DisableCollisions.h"