Combos now show up as a particle when it is reset

This commit is contained in:
tleety
2015-10-14 18:07:15 +02:00
parent 471fbacfd6
commit 6c41911233
3 changed files with 38 additions and 3 deletions
+1
View File
@@ -35,6 +35,7 @@
#include "Game/EHitLag.h"
#include "Game/EActionButton.h"
#include "Game/ELifebuoyHit.h"
#include "Physics/ECreateParticleSequence.h"
namespace dd
{
+2 -3
View File
@@ -57,9 +57,6 @@ namespace dd
~PhysicsSystem();
EventRelay<PhysicsSystem, Events::CreateParticleSequence> m_ECreateParticleSequence;
bool CreateParticleSequence(const Events::CreateParticleSequence &event);
void RegisterComponents(ComponentFactory* cf) override;
void Initialize() override;
void Update(double dt) override;
@@ -116,6 +113,8 @@ namespace dd
bool OnPause(const dd::Events::Pause &event);
dd::EventRelay<PhysicsSystem, dd::Events::Contact> m_EContact;
bool OnContact(const dd::Events::Contact &event);
EventRelay<PhysicsSystem, Events::CreateParticleSequence> m_ECreateParticleSequence;
bool CreateParticleSequence(const Events::CreateParticleSequence &event);
//TODO: Fill struct with info needed.
struct EmitterHandler //TODO CHANGE NAMES
+35
View File
@@ -26,6 +26,7 @@ void dd::Systems::BallSystem::Initialize()
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &BallSystem::OnStageCleared);
EVENT_SUBSCRIBE_MEMBER(m_EArrivedAtNewStage, &BallSystem::OnArrivedToNewStage);
//OctoBall
{
auto ent = m_World->CreateEntity();
@@ -287,6 +288,40 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event)
float x = (ballTransform->Position.x - padTransform->Position.x) * XMovementMultiplier();
float y = glm::cos((abs(x) / (1.6f)) * glm::pi<float>() / 2.f) + 1.f;
//When a combo is more than 2 create a particle showing it.
if (ballComponent->Combo >= 1){
Events::CreateParticleSequence particleEvent;
particleEvent.EmitterLifeTime = 3;
particleEvent.EmittingAngle = glm::half_pi<float>();
particleEvent.Spread = 0.f;
particleEvent.NumberOfTicks = 1;
particleEvent.ParticleLifeTime = 2.f;
particleEvent.ParticlesPerTick = 1;
particleEvent.Position = glm::vec3(ballTransform->Position.x, -3.f, -3.f);
if (ballTransform->Position.x >= 2.7f) {
particleEvent.Position = glm::vec3(2.7f, -3.f, -3.f);
} else if (ballTransform->Position.x <= -2.7f) {
particleEvent.Position = glm::vec3(-2.7f, -3.f, -3.f);
}
particleEvent.Radius = 1.f;
particleEvent.Color = glm::vec4(1.f);
particleEvent.Speed = 0;
if (ballComponent->Combo <= 9) {
particleEvent.SpriteFile = "Textures/Combo/Combo00" + std::to_string(ballComponent->Combo) + ".png";
} else if (ballComponent->Combo <= 99) {
particleEvent.SpriteFile = "Textures/Combo/Combo0" + std::to_string(ballComponent->Combo) + ".png";
} else {
particleEvent.SpriteFile = "Textures/Combo/Combo" + std::to_string(ballComponent->Combo) + ".png";
}
EventBroker->Publish(particleEvent);
}
ballComponent->Combo = 0;
if (!ballComponent->Waiting) {
if (m_InkBlaster) {