CreateExplosion event published on shell collision now.
This commit is contained in:
@@ -85,19 +85,6 @@ void InputManager::Update(double dt)
|
|||||||
EventBroker->Publish(e);
|
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
|
// // Lock mouse while holding LMB
|
||||||
// if (m_CurrentMouseState[GLFW_MOUSE_BUTTON_LEFT])
|
// if (m_CurrentMouseState[GLFW_MOUSE_BUTTON_LEFT])
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
#include "Events/LockMouse.h"
|
#include "Events/LockMouse.h"
|
||||||
#include "Events/GamepadAxis.h"
|
#include "Events/GamepadAxis.h"
|
||||||
#include "Events/GamepadButton.h"
|
#include "Events/GamepadButton.h"
|
||||||
#include "Events/CreateExplosion.h"
|
|
||||||
|
|
||||||
class InputManager
|
class InputManager
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -126,6 +126,29 @@ bool Systems::TankSteeringSystem::OnCollision( const Events::Collision &e )
|
|||||||
auto physicsComponents = m_World->GetComponentsOfType<Components::Physics>();
|
auto physicsComponents = m_World->GetComponentsOfType<Components::Physics>();
|
||||||
auto shellTransform = m_World->GetComponent<Components::Transform>(shellEntity);
|
auto shellTransform = m_World->GetComponent<Components::Transform>(shellEntity);
|
||||||
//auto otherTransform = m_World->GetComponent<Components::Transform>(otherEntity);
|
//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)
|
for (auto &physComponent : *physicsComponents)
|
||||||
{
|
{
|
||||||
EntityID physicsEntity = std::dynamic_pointer_cast<Components::Physics>(physComponent)->Entity;
|
EntityID physicsEntity = std::dynamic_pointer_cast<Components::Physics>(physComponent)->Entity;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "Events/SetVelocity.h"
|
#include "Events/SetVelocity.h"
|
||||||
#include "Events/ApplyForce.h"
|
#include "Events/ApplyForce.h"
|
||||||
#include "Events/ApplyPointImpulse.h"
|
#include "Events/ApplyPointImpulse.h"
|
||||||
|
#include "Events/CreateExplosion.h"
|
||||||
#include "Events/Collision.h"
|
#include "Events/Collision.h"
|
||||||
#include "Components/Transform.h"
|
#include "Components/Transform.h"
|
||||||
#include "Components/TankSteering.h"
|
#include "Components/TankSteering.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user