CreateExplosion event published on shell collision now.

This commit is contained in:
Stiffly
2014-05-31 22:15:44 +02:00
parent a31e3faa1f
commit d407502432
4 changed files with 24 additions and 14 deletions
-13
View File
@@ -85,19 +85,6 @@ void InputManager::Update(double dt)
EventBroker->Publish(e);
}
if(m_CurrentKeyState[GLFW_KEY_Z])
{
Events::CreateExplosion e;
e.LifeTime = 1;
e.ParticleScale = 6;
e.ParticlesToSpawn = 1;
e.Position = glm::vec3(0, -15, 0);
e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
e.Speed = 3;
e.SpreadAngle = glm::pi<float>();
e.spritePath = "Textures/Sprites/SeriousParticle.png";
EventBroker->Publish(e);
}
// // Lock mouse while holding LMB
// if (m_CurrentMouseState[GLFW_MOUSE_BUTTON_LEFT])
-1
View File
@@ -12,7 +12,6 @@
#include "Events/LockMouse.h"
#include "Events/GamepadAxis.h"
#include "Events/GamepadButton.h"
#include "Events/CreateExplosion.h"
class InputManager
{
+23
View File
@@ -126,6 +126,29 @@ bool Systems::TankSteeringSystem::OnCollision( const Events::Collision &e )
auto physicsComponents = m_World->GetComponentsOfType<Components::Physics>();
auto shellTransform = m_World->GetComponent<Components::Transform>(shellEntity);
//auto otherTransform = m_World->GetComponent<Components::Transform>(otherEntity);
{
Events::CreateExplosion e;
e.LifeTime = 2;
e.ParticleScale = 8;
e.ParticlesToSpawn = 10;
e.Position = shellTransform->Position;
e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
e.Speed = 3;
e.SpreadAngle = glm::pi<float>();
e.spritePath = "Textures/Sprites/Smoke1.png";
EventBroker->Publish(e);
e.LifeTime = 1;
e.ParticleScale = 12;
e.ParticlesToSpawn = 10;
e.Position = shellTransform->Position;
e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
e.Speed = 6;
e.SpreadAngle = glm::pi<float>();
e.spritePath = "Textures/Sprites/Fire.png";
EventBroker->Publish(e);
}
for (auto &physComponent : *physicsComponents)
{
EntityID physicsEntity = std::dynamic_pointer_cast<Components::Physics>(physComponent)->Entity;
+1
View File
@@ -5,6 +5,7 @@
#include "Events/SetVelocity.h"
#include "Events/ApplyForce.h"
#include "Events/ApplyPointImpulse.h"
#include "Events/CreateExplosion.h"
#include "Events/Collision.h"
#include "Components/Transform.h"
#include "Components/TankSteering.h"