Tanks now have listeners.

This commit is contained in:
Stiffly
2014-06-04 04:40:16 +02:00
parent 9813e9a058
commit 7f017bfaed
3 changed files with 13 additions and 11 deletions
+1 -1
Submodule assets updated: 78ba667b37...a6e3f120fd
+11 -10
View File
@@ -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<Components::Physics>(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<Components::Input>(tank);
auto health = m_World->AddComponent<Components::Health>(tank);
health->Amount = 100.f;
m_World->AddComponent<Components::Listener>(tank);
{
auto shape = m_World->CreateEntity(tank);
+1
View File
@@ -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"