Combos now show up as a particle when it is reset
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
#include "Game/EHitLag.h"
|
#include "Game/EHitLag.h"
|
||||||
#include "Game/EActionButton.h"
|
#include "Game/EActionButton.h"
|
||||||
#include "Game/ELifebuoyHit.h"
|
#include "Game/ELifebuoyHit.h"
|
||||||
|
#include "Physics/ECreateParticleSequence.h"
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,9 +57,6 @@ namespace dd
|
|||||||
|
|
||||||
~PhysicsSystem();
|
~PhysicsSystem();
|
||||||
|
|
||||||
EventRelay<PhysicsSystem, Events::CreateParticleSequence> m_ECreateParticleSequence;
|
|
||||||
bool CreateParticleSequence(const Events::CreateParticleSequence &event);
|
|
||||||
|
|
||||||
void RegisterComponents(ComponentFactory* cf) override;
|
void RegisterComponents(ComponentFactory* cf) override;
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
void Update(double dt) override;
|
void Update(double dt) override;
|
||||||
@@ -116,6 +113,8 @@ namespace dd
|
|||||||
bool OnPause(const dd::Events::Pause &event);
|
bool OnPause(const dd::Events::Pause &event);
|
||||||
dd::EventRelay<PhysicsSystem, dd::Events::Contact> m_EContact;
|
dd::EventRelay<PhysicsSystem, dd::Events::Contact> m_EContact;
|
||||||
bool OnContact(const dd::Events::Contact &event);
|
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.
|
//TODO: Fill struct with info needed.
|
||||||
struct EmitterHandler //TODO CHANGE NAMES
|
struct EmitterHandler //TODO CHANGE NAMES
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ void dd::Systems::BallSystem::Initialize()
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &BallSystem::OnStageCleared);
|
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &BallSystem::OnStageCleared);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EArrivedAtNewStage, &BallSystem::OnArrivedToNewStage);
|
EVENT_SUBSCRIBE_MEMBER(m_EArrivedAtNewStage, &BallSystem::OnArrivedToNewStage);
|
||||||
|
|
||||||
|
|
||||||
//OctoBall
|
//OctoBall
|
||||||
{
|
{
|
||||||
auto ent = m_World->CreateEntity();
|
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 x = (ballTransform->Position.x - padTransform->Position.x) * XMovementMultiplier();
|
||||||
float y = glm::cos((abs(x) / (1.6f)) * glm::pi<float>() / 2.f) + 1.f;
|
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;
|
ballComponent->Combo = 0;
|
||||||
if (!ballComponent->Waiting) {
|
if (!ballComponent->Waiting) {
|
||||||
if (m_InkBlaster) {
|
if (m_InkBlaster) {
|
||||||
|
|||||||
Reference in New Issue
Block a user