Pause and Resume events completed and game-crashing bug fixed. I think.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "Game/EArrivedAtNewStage.h"
|
||||
#include "Game/EGameOver.h"
|
||||
#include "Game/EPause.h"
|
||||
#include "Game/EResume.h"
|
||||
#include "Game/EHitPad.h"
|
||||
#include "Game/EHitLag.h"
|
||||
#include "Game/EActionButton.h"
|
||||
@@ -127,6 +128,7 @@ private:
|
||||
dd::EventRelay<BallSystem, dd::Events::InkBlaster> m_EInkBlaster;
|
||||
dd::EventRelay<BallSystem, dd::Events::InkBlasterOver> m_EInkBlasterOver;
|
||||
dd::EventRelay<BallSystem, dd::Events::Pause> m_EPause;
|
||||
dd::EventRelay<BallSystem, dd::Events::Resume> m_EResume;
|
||||
dd::EventRelay<BallSystem, dd::Events::Contact> m_Contact;
|
||||
dd::EventRelay<BallSystem, dd::Events::ActionButton> m_EActionButton;
|
||||
dd::EventRelay<BallSystem, dd::Events::StageCleared> m_EStageCleared;
|
||||
@@ -141,6 +143,7 @@ private:
|
||||
bool OnInkBlaster(const dd::Events::InkBlaster &event);
|
||||
bool OnInkBlasterOver(const dd::Events::InkBlasterOver &event);
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnResume(const dd::Events::Resume &event);
|
||||
bool OnActionButton(const dd::Events::ActionButton &event);
|
||||
bool OnStageCleared(const dd::Events::StageCleared &event);
|
||||
bool OnArrivedToNewStage(const dd::Events::ArrivedAtNewStage &event);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by Adniklastrator on 2015-10-19.
|
||||
//
|
||||
|
||||
#ifndef DAYDREAM_ERESUME_H
|
||||
#define DAYDREAM_ERESUME_H
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct Resume : Event
|
||||
{
|
||||
std::string Type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //DAYDREAM_ERESUME_H
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "Game/EMultiBall.h"
|
||||
#include "Game/EMultiBallLost.h"
|
||||
#include "Game/EPause.h"
|
||||
#include "Game/EResume.h"
|
||||
#include "Game/EHitLag.h"
|
||||
#include "Game/EGameOver.h"
|
||||
#include "Game/ECreatePowerUp.h"
|
||||
@@ -70,16 +71,18 @@ public:
|
||||
std::string& CurrentType() { return m_CurrentType; }
|
||||
void SetCurrentType(const std::string& currentType) { m_CurrentType = currentType; }
|
||||
private:
|
||||
bool m_Pause;
|
||||
bool m_HitLag;
|
||||
bool m_Pause = false;
|
||||
bool m_HitLag = false;
|
||||
float m_HitLagDuration;
|
||||
float m_HitLagTimer;
|
||||
std::string m_CurrentType;
|
||||
|
||||
dd::EventRelay<HitLagSystem, dd::Events::Pause> m_EPause;
|
||||
dd::EventRelay<HitLagSystem, dd::Events::Resume> m_EResume;
|
||||
dd::EventRelay<HitLagSystem, dd::Events::HitLag> m_EHitLag;
|
||||
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnResume(const dd::Events::Resume &event);
|
||||
bool OnHitLag(const dd::Events::HitLag &event);
|
||||
|
||||
};
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "Physics/CPhysics.h"
|
||||
#include "Physics/EContact.h"
|
||||
#include "Game/EPause.h"
|
||||
#include "Game/EResume.h"
|
||||
#include "Game/EKrakenAppear.h"
|
||||
#include "Game/EKrakenAttack.h"
|
||||
#include "Game/EBrickGenerating.h"
|
||||
@@ -64,11 +65,13 @@ private:
|
||||
std::array<int, 14> m_Colors;
|
||||
|
||||
dd::EventRelay<KrakenSystem, dd::Events::Pause> m_EPause;
|
||||
dd::EventRelay<KrakenSystem, dd::Events::Resume> m_EResume;
|
||||
dd::EventRelay<KrakenSystem, dd::Events::Contact> m_EContact;
|
||||
dd::EventRelay<KrakenSystem, dd::Events::KrakenAppear> m_EKrakenAppear;
|
||||
dd::EventRelay<KrakenSystem, dd::Events::KrakenAttack> m_EKrakenAttack;
|
||||
dd::EventRelay<KrakenSystem, dd::Events::BrickGenerating> m_EBrickGenerating;
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnResume(const dd::Events::Resume &event);
|
||||
bool OnContact(const dd::Events::Contact &event);
|
||||
bool OnKrakenAppear(const dd::Events::KrakenAppear &event);
|
||||
bool OnKrakenAttack(const dd::Events::KrakenAttack &event);
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "Game/EMultiBall.h"
|
||||
#include "Game/EMultiBallLost.h"
|
||||
#include "Game/EPause.h"
|
||||
#include "Game/EResume.h"
|
||||
#include "Game/EGameOver.h"
|
||||
#include "Game/EClusterClear.h"
|
||||
#include "Game/ECreatePowerUp.h"
|
||||
@@ -174,6 +175,7 @@ private:
|
||||
dd::EventRelay<LevelSystem, dd::Events::PowerUpTaken> m_EPowerUpTaken;
|
||||
dd::EventRelay<LevelSystem, dd::Events::StageCleared> m_EStageCleared;
|
||||
dd::EventRelay<LevelSystem, dd::Events::Pause> m_EPause;
|
||||
dd::EventRelay<LevelSystem, dd::Events::Resume> m_EResume;
|
||||
dd::EventRelay<LevelSystem, dd::Events::HitPad> m_EHitPad;
|
||||
dd::EventRelay<LevelSystem, dd::Events::BrickGenerating> m_EBrickGenerating;
|
||||
|
||||
@@ -185,6 +187,7 @@ private:
|
||||
bool OnPowerUpTaken(const dd::Events::PowerUpTaken &event);
|
||||
bool OnStageCleared(const dd::Events::StageCleared &event);
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnResume(const dd::Events::Resume &event);
|
||||
bool OnHitPad(const dd::Events::HitPad &event);
|
||||
bool OnBrickGenerating(const dd::Events::BrickGenerating &event);
|
||||
void GetBrickSet(int Set);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "Physics/CPhysics.h"
|
||||
#include "Physics/CRectangleShape.h"
|
||||
#include "Game/EPause.h"
|
||||
#include "Game/EResume.h"
|
||||
#include "Game/ELifebuoy.h"
|
||||
#include "Game/ELifebuoyHit.h"
|
||||
#include "Game/CLifebuoy.h"
|
||||
@@ -48,11 +49,13 @@ private:
|
||||
|
||||
dd::EventRelay<LifebuoySystem, dd::Events::Contact> m_EContact;
|
||||
dd::EventRelay<LifebuoySystem, dd::Events::Pause> m_EPause;
|
||||
dd::EventRelay<LifebuoySystem, dd::Events::Resume> m_EResume;
|
||||
dd::EventRelay<LifebuoySystem, dd::Events::Lifebuoy> m_ELifebuoy;
|
||||
dd::EventRelay<LifebuoySystem, dd::Events::LifebuoyHit> m_ELifebuoyHit;
|
||||
|
||||
bool OnContact(const dd::Events::Contact &event);
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnResume(const dd::Events::Resume &event);
|
||||
bool OnLifebuoy(const dd::Events::Lifebuoy &event);
|
||||
bool OnLifebuoyHit(const dd::Events::LifebuoyHit &event);
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "Game/EPowerUpTaken.h"
|
||||
#include "Game/EStageCleared.h"
|
||||
#include "Game/EPause.h"
|
||||
#include "Game/EResume.h"
|
||||
#include "Game/EHitLag.h"
|
||||
#include "Game/EScreenShake.h"
|
||||
#include "Game/EActionButton.h"
|
||||
@@ -118,6 +119,7 @@ private:
|
||||
dd::EventRelay<PadSystem, dd::Events::ResetAll> m_EResetAll;
|
||||
dd::EventRelay<PadSystem, dd::Events::RaiseWater> m_ERaiseWater;
|
||||
dd::EventRelay<PadSystem, dd::Events::Pause> m_EPause;
|
||||
dd::EventRelay<PadSystem, dd::Events::Resume> m_EResume;
|
||||
dd::EventRelay<PadSystem, dd::Events::KrakenAttack> m_EKrakenAttack;
|
||||
dd::EventRelay<PadSystem, dd::Events::StickyPad> m_EStickyPad;
|
||||
dd::EventRelay<PadSystem, dd::Events::StickyAttachedToPad> m_EStickyAttachedToPad;
|
||||
@@ -132,6 +134,7 @@ private:
|
||||
bool OnResetAll(const dd::Events::ResetAll &event);
|
||||
bool OnRaiseWater(const dd::Events::RaiseWater &event);
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnResume(const dd::Events::Resume &event);
|
||||
bool OnKrakenAttack(const dd::Events::KrakenAttack &event);
|
||||
bool OnStickyPad(const dd::Events::StickyPad &event);
|
||||
bool OnStickyAttachedToPad(const dd::Events::StickyAttachedToPad &event);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "Physics/CPhysics.h"
|
||||
#include "Physics/CCircleShape.h"
|
||||
#include "Game/EPause.h"
|
||||
#include "Game/EResume.h"
|
||||
#include "Game/EInkBlaster.h"
|
||||
#include "Game/EInkBlasterOver.h"
|
||||
#include "Game/EActionButton.h"
|
||||
@@ -56,12 +57,14 @@ private:
|
||||
|
||||
dd::EventRelay<ProjectileSystem, dd::Events::Contact> m_EContact;
|
||||
dd::EventRelay<ProjectileSystem, dd::Events::Pause> m_EPause;
|
||||
dd::EventRelay<ProjectileSystem, dd::Events::Resume> m_EResume;
|
||||
dd::EventRelay<ProjectileSystem, dd::Events::InkBlaster> m_EInkBlaster;
|
||||
dd::EventRelay<ProjectileSystem, dd::Events::HitPad> m_EHitPad;
|
||||
dd::EventRelay<ProjectileSystem, dd::Events::ActionButton> m_EActionButton;
|
||||
|
||||
bool OnContact(const dd::Events::Contact &event);
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnResume(const dd::Events::Resume &event);
|
||||
bool OnInkBlaster(const dd::Events::InkBlaster &event);
|
||||
bool OnHitPad(const dd::Events::HitPad &event);
|
||||
bool OnActionButton(const dd::Events::ActionButton &event);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "Core/EventBroker.h"
|
||||
#include "Core/World.h"
|
||||
#include "Game/EPause.h"
|
||||
#include "Game/EResume.h"
|
||||
#include "Game/EScreenShake.h"
|
||||
//#include "Core/Camera.h" Camera Component
|
||||
|
||||
@@ -53,8 +54,10 @@ private:
|
||||
glm::vec3 m_Random;
|
||||
|
||||
dd::EventRelay<ScreenShakeSystem, dd::Events::Pause> m_EPause;
|
||||
dd::EventRelay<ScreenShakeSystem, dd::Events::Resume> m_EResume;
|
||||
dd::EventRelay<ScreenShakeSystem, dd::Events::ScreenShake> m_EScreenShake;
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnResume(const dd::Events::Resume &event);
|
||||
bool OnScreenShake(const dd::Events::ScreenShake &event);
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "Core/World.h"
|
||||
#include "Transform/EMove.h"
|
||||
#include "Game/EPause.h"
|
||||
#include "Game/EResume.h"
|
||||
#include "Game/EArrivedAtNewStage.h"
|
||||
#include "Game/EStageCleared.h"
|
||||
#include "Game/CTravels.h"
|
||||
@@ -47,10 +48,12 @@ private:
|
||||
float m_DistanceTravelled = 0;
|
||||
|
||||
dd::EventRelay<TravellingSystem, dd::Events::Pause> m_EPause;
|
||||
dd::EventRelay<TravellingSystem, dd::Events::Resume> m_EResume;
|
||||
dd::EventRelay<TravellingSystem, dd::Events::StageCleared> m_EStageCleared;
|
||||
dd::EventRelay<TravellingSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage;
|
||||
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnResume(const dd::Events::Resume &event);
|
||||
bool OnStageCleared(const dd::Events::StageCleared &event);
|
||||
bool OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event);
|
||||
};
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "CRectangleShape.h"
|
||||
#include "Game/EPause.h"
|
||||
#include "Game/EResume.h"
|
||||
#include "Game/CPad.h"
|
||||
#include "Game/CBrick.h"
|
||||
#include "Game/CBall.h"
|
||||
@@ -114,6 +115,8 @@ namespace dd
|
||||
bool SetImpulse(const Events::SetImpulse &event);
|
||||
dd::EventRelay<PhysicsSystem, dd::Events::Pause> m_EPause;
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
dd::EventRelay<PhysicsSystem, dd::Events::Resume> m_EResume;
|
||||
bool OnResume(const dd::Events::Resume &event);
|
||||
dd::EventRelay<PhysicsSystem, dd::Events::Contact> m_EContact;
|
||||
bool OnContact(const dd::Events::Contact &event);
|
||||
EventRelay<PhysicsSystem, Events::CreateParticleSequence> m_ECreateParticleSequence;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Core/World.h"
|
||||
#include "Rendering/CAnimation.h"
|
||||
#include "Game/EPause.h"
|
||||
#include "Game/EResume.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
@@ -25,7 +26,9 @@ private:
|
||||
bool m_Paused = false;
|
||||
|
||||
EventRelay<AnimationSystem, Events::Pause> m_EPause;
|
||||
EventRelay<AnimationSystem, Events::Resume> m_EResume;
|
||||
bool OnPause(const Events::Pause& e);
|
||||
bool OnResume(const Events::Resume& e);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ void dd::Systems::BallSystem::Initialize()
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EStickyPad, &BallSystem::OnStickyPad);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EInkBlaster, &BallSystem::OnInkBlaster);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EInkBlasterOver, &BallSystem::OnInkBlasterOver);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &BallSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &BallSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &BallSystem::OnResume);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &BallSystem::OnActionButton);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &BallSystem::OnStageCleared);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EArrivedAtNewStage, &BallSystem::OnArrivedToNewStage);
|
||||
@@ -86,8 +87,13 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
{
|
||||
//TODO: When the ball collides with 2 bricks on the same frame it is reflected and then reflected again, make it reflect only once like a list or something?
|
||||
|
||||
if (IsPaused()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto ballComponent = m_World->GetComponent<Components::Ball>(entity);
|
||||
if (IsPaused()) {
|
||||
|
||||
/*if (IsPaused()) {
|
||||
if (ballComponent != nullptr) {
|
||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||
|
||||
@@ -107,7 +113,7 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
ballComponent->Paused = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
||||
if (templateCheck != nullptr){ return; }
|
||||
@@ -211,18 +217,26 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
|
||||
bool dd::Systems::BallSystem::OnPause(const dd::Events::Pause &event)
|
||||
{
|
||||
if (event.Type != "BallSystem" && event.Type != "All") {
|
||||
/*if (event.Type != "BallSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
m_Pause = true;
|
||||
|
||||
if (IsPaused()) {
|
||||
SetPause(false);
|
||||
} else {
|
||||
SetPause(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::BallSystem::OnResume(const dd::Events::Resume &event)
|
||||
{
|
||||
/*if (event.Type != "BallSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}*/
|
||||
|
||||
m_Pause = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void dd::Systems::BallSystem::OnEntityCommit(EntityID entity)
|
||||
{
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
void dd::Systems::HitLagSystem::Initialize()
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &HitLagSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &HitLagSystem::OnResume);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EHitLag, &HitLagSystem::OnHitLag);
|
||||
}
|
||||
|
||||
@@ -29,25 +30,33 @@ void dd::Systems::HitLagSystem::Update(double dt)
|
||||
|
||||
void dd::Systems::HitLagSystem::FlipPause()
|
||||
{
|
||||
Events::Pause e;
|
||||
e.Type = CurrentType();
|
||||
EventBroker->Publish(e);
|
||||
if (!IsPaused()) {
|
||||
Events::Pause e;
|
||||
e.Type = CurrentType();
|
||||
EventBroker->Publish(e);
|
||||
} else {
|
||||
Events::Resume e;
|
||||
e.Type = CurrentType();
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
}
|
||||
|
||||
bool dd::Systems::HitLagSystem::OnPause(const dd::Events::Pause &event)
|
||||
{
|
||||
if (IsPaused()) {
|
||||
SetPause(false);
|
||||
} else {
|
||||
SetPause(true);
|
||||
}
|
||||
m_Pause = true;
|
||||
return true;
|
||||
}
|
||||
bool dd::Systems::HitLagSystem::OnResume(const dd::Events::Resume &event)
|
||||
{
|
||||
m_Pause = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::HitLagSystem::OnHitLag(const dd::Events::HitLag &event)
|
||||
{
|
||||
if (HitLag()) {
|
||||
FlipPause();
|
||||
SetHitLagTimer(0);
|
||||
}
|
||||
SetHitLag(true);
|
||||
SetCurrentType(event.Type);
|
||||
|
||||
@@ -10,6 +10,7 @@ void dd::Systems::KrakenSystem::Initialize()
|
||||
std::random_device rd;
|
||||
m_RandomGenerator = std::mt19937(rd());
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &KrakenSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &KrakenSystem::OnResume);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAppear, &KrakenSystem::OnKrakenAppear);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &KrakenSystem::OnKrakenAttack);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EBrickGenerating, &KrakenSystem::OnBrickGenerating);
|
||||
@@ -51,7 +52,9 @@ void dd::Systems::KrakenSystem::InitializeObjects()
|
||||
|
||||
void dd::Systems::KrakenSystem::Update(double dt)
|
||||
{
|
||||
|
||||
if (m_Pause) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void dd::Systems::KrakenSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||
@@ -105,18 +108,24 @@ void dd::Systems::KrakenSystem::UpdateEntity(double dt, EntityID entity, EntityI
|
||||
|
||||
bool dd::Systems::KrakenSystem::OnPause(const dd::Events::Pause &event)
|
||||
{
|
||||
if (event.Type != "KrakenSystem" && event.Type != "All") {
|
||||
/*if (event.Type != "KrakenSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
m_Pause = true;
|
||||
|
||||
if (IsPaused()) {
|
||||
SetPause(false);
|
||||
} else {
|
||||
SetPause(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::KrakenSystem::OnResume(const dd::Events::Resume &event)
|
||||
{
|
||||
/*if (event.Type != "KrakenSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}*/
|
||||
m_Pause = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::KrakenSystem::OnKrakenAppear(const dd::Events::KrakenAppear &event)
|
||||
{
|
||||
auto ent = m_World->CloneEntity(m_KrakenTemplate);
|
||||
|
||||
@@ -19,6 +19,7 @@ void dd::Systems::LevelSystem::Initialize()
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPowerUpTaken, &LevelSystem::OnPowerUpTaken);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &LevelSystem::OnStageCleared);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &LevelSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &LevelSystem::OnResume);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EHitPad, &LevelSystem::OnHitPad);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EBrickGenerating, &LevelSystem::OnBrickGenerating);
|
||||
|
||||
@@ -338,18 +339,24 @@ void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
|
||||
bool dd::Systems::LevelSystem::OnPause(const dd::Events::Pause &event)
|
||||
{
|
||||
if (event.Type != "LevelSystem" && event.Type != "All") {
|
||||
/*if (event.Type != "LevelSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
m_Pause = true;
|
||||
|
||||
if (IsPaused()) {
|
||||
SetPause(false);
|
||||
} else {
|
||||
SetPause(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::LevelSystem::OnResume(const dd::Events::Resume &event)
|
||||
{
|
||||
/*if (event.Type != "LevelSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}*/
|
||||
m_Pause = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void dd::Systems::LevelSystem::CreateBasicLevel(int rows, int lines, glm::vec2 spacesBetweenBricks, float spaceToEdge)
|
||||
{
|
||||
SetNumberOfBricks(rows * lines);
|
||||
|
||||
@@ -11,6 +11,7 @@ void dd::Systems::LifebuoySystem::Initialize()
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EContact, &LifebuoySystem::OnContact);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &LifebuoySystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &LifebuoySystem::OnResume);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_ELifebuoy, &LifebuoySystem::OnLifebuoy);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_ELifebuoyHit, &LifebuoySystem::OnLifebuoyHit);
|
||||
|
||||
@@ -88,18 +89,23 @@ void dd::Systems::LifebuoySystem::UpdateEntity(double dt, EntityID entity, Entit
|
||||
|
||||
bool dd::Systems::LifebuoySystem::OnPause(const dd::Events::Pause &event)
|
||||
{
|
||||
if (event.Type != "LifebuoySystem" && event.Type != "All") {
|
||||
/*if (event.Type != "LifebuoySystem" && event.Type != "All") {
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
m_Pause = true;
|
||||
|
||||
if (IsPaused()) {
|
||||
SetPause(false);
|
||||
} else {
|
||||
SetPause(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::LifebuoySystem::OnResume(const dd::Events::Resume &event)
|
||||
{
|
||||
/*if (event.Type != "LifebuoySystem" && event.Type != "All") {
|
||||
return false;
|
||||
}*/
|
||||
m_Pause = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::LifebuoySystem::OnContact(const dd::Events::Contact &event)
|
||||
{
|
||||
|
||||
+27
-10
@@ -31,6 +31,7 @@ void dd::Systems::PadSystem::Initialize()
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResetAll, &PadSystem::OnResetAll);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_ERaiseWater, &PadSystem::OnRaiseWater);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &PadSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &PadSystem::OnResume);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &PadSystem::OnKrakenAttack);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EStickyPad, &PadSystem::OnStickyPad);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EStickyAttachedToPad, &PadSystem::OnStickyAttachedToPad);
|
||||
@@ -80,6 +81,10 @@ void dd::Systems::PadSystem::Initialize()
|
||||
|
||||
void dd::Systems::PadSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||
{
|
||||
if (m_Pause) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
||||
if (templateCheck != nullptr){ return; }
|
||||
|
||||
@@ -176,18 +181,24 @@ void dd::Systems::PadSystem::Update(double dt)
|
||||
|
||||
bool dd::Systems::PadSystem::OnPause(const dd::Events::Pause &event)
|
||||
{
|
||||
if (event.Type != "PadSystem" && event.Type != "All") {
|
||||
/*if (event.Type != "PadSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
m_Pause = true;
|
||||
|
||||
if (IsPaused()) {
|
||||
SetPause(false);
|
||||
} else {
|
||||
SetPause(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::PadSystem::OnResume(const dd::Events::Resume &event)
|
||||
{
|
||||
/*if (event.Type != "PadSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}*/
|
||||
m_Pause = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) {
|
||||
int val = event.KeyCode;
|
||||
if (val == GLFW_KEY_UP) {
|
||||
@@ -217,9 +228,15 @@ bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) {
|
||||
e.padTransform = Transform();
|
||||
EventBroker->Publish(e);
|
||||
} else if (val == GLFW_KEY_P) {
|
||||
Events::Pause e;
|
||||
e.Type = "All";
|
||||
EventBroker->Publish(e);
|
||||
if (IsPaused()) {
|
||||
Events::Resume e;
|
||||
e.Type = "All";
|
||||
EventBroker->Publish(e);
|
||||
} else {
|
||||
Events::Pause e;
|
||||
e.Type = "All";
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
} else if (val == GLFW_KEY_H) {
|
||||
Events::HitLag e;
|
||||
e.Time = 0.2;
|
||||
|
||||
@@ -11,6 +11,7 @@ void dd::Systems::ProjectileSystem::Initialize()
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EContact, &ProjectileSystem::OnContact);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &ProjectileSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &ProjectileSystem::OnResume);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EInkBlaster, &ProjectileSystem::OnInkBlaster);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EHitPad, &ProjectileSystem::OnHitPad);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &ProjectileSystem::OnActionButton);
|
||||
@@ -45,7 +46,9 @@ void dd::Systems::ProjectileSystem::Initialize()
|
||||
|
||||
void dd::Systems::ProjectileSystem::Update(double dt)
|
||||
{
|
||||
|
||||
if (m_Pause) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void dd::Systems::ProjectileSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||
@@ -67,18 +70,23 @@ void dd::Systems::ProjectileSystem::UpdateEntity(double dt, EntityID entity, Ent
|
||||
|
||||
bool dd::Systems::ProjectileSystem::OnPause(const dd::Events::Pause &event)
|
||||
{
|
||||
if (event.Type != "ProjectileSystem" && event.Type != "All") {
|
||||
/*if (event.Type != "ProjectileSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
m_Pause = true;
|
||||
|
||||
if (IsPaused()) {
|
||||
SetPause(false);
|
||||
} else {
|
||||
SetPause(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::ProjectileSystem::OnResume(const dd::Events::Resume &event)
|
||||
{
|
||||
/*if (event.Type != "ProjectileSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}*/
|
||||
m_Pause = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::ProjectileSystem::OnContact(const dd::Events::Contact &event)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@ void dd::Systems::ScreenShakeSystem::Initialize()
|
||||
std::random_device rd;
|
||||
m_RandomGenerator = std::mt19937(rd());
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &ScreenShakeSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &ScreenShakeSystem::OnResume);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EScreenShake, &ScreenShakeSystem::OnScreenShake);
|
||||
|
||||
InitializeObjects();
|
||||
@@ -77,17 +78,21 @@ void dd::Systems::ScreenShakeSystem::UpdateEntity(double dt, EntityID entity, En
|
||||
|
||||
bool dd::Systems::ScreenShakeSystem::OnPause(const dd::Events::Pause &event)
|
||||
{
|
||||
if (event.Type != "ScreenShakeSystem" && event.Type != "All") {
|
||||
/*if (event.Type != "ScreenShakeSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (IsPaused()) {
|
||||
SetPause(false);
|
||||
} else {
|
||||
SetPause(true);
|
||||
}
|
||||
m_Pause = true;
|
||||
return true;
|
||||
}
|
||||
bool dd::Systems::ScreenShakeSystem::OnResume(const dd::Events::Resume &event)
|
||||
{
|
||||
/*if (event.Type != "ScreenShakeSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}*/
|
||||
m_Pause = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::ScreenShakeSystem::OnScreenShake(const dd::Events::ScreenShake &event)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
void dd::Systems::TravellingSystem::Initialize()
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &TravellingSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &TravellingSystem::OnResume);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &TravellingSystem::OnStageCleared);
|
||||
}
|
||||
|
||||
@@ -30,6 +31,10 @@ void dd::Systems::TravellingSystem::Update(double dt)
|
||||
|
||||
void dd::Systems::TravellingSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||
{
|
||||
if (m_Pause) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
||||
if (templateCheck != nullptr){ return; }
|
||||
|
||||
@@ -75,17 +80,20 @@ void dd::Systems::TravellingSystem::UpdateEntity(double dt, EntityID entity, Ent
|
||||
|
||||
bool dd::Systems::TravellingSystem::OnPause(const dd::Events::Pause &event)
|
||||
{
|
||||
if (event.Type != "TravellingSystem" && event.Type != "All") {
|
||||
/*if (event.Type != "TravellingSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsPaused()) {
|
||||
SetPause(false);
|
||||
} else {
|
||||
SetPause(true);
|
||||
}
|
||||
}*/
|
||||
m_Pause = true;
|
||||
return true;
|
||||
}
|
||||
bool dd::Systems::TravellingSystem::OnResume(const dd::Events::Resume &event)
|
||||
{
|
||||
/*if (event.Type != "TravellingSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}*/
|
||||
m_Pause = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::TravellingSystem::OnStageCleared(const dd::Events::StageCleared &event)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ void dd::Systems::PhysicsSystem::Initialize()
|
||||
InitializeWater();
|
||||
EVENT_SUBSCRIBE_MEMBER(m_SetImpulse, &PhysicsSystem::SetImpulse);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &PhysicsSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &PhysicsSystem::OnResume);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_ECreateParticleSequence, &PhysicsSystem::CreateParticleSequence);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EContact, &PhysicsSystem::OnContact);
|
||||
}
|
||||
@@ -244,6 +245,10 @@ void dd::Systems::PhysicsSystem::Update(double dt)
|
||||
|
||||
void dd::Systems::PhysicsSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||
{
|
||||
if (m_Pause) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto particle = m_World->GetComponent<Components::Particle>(entity);
|
||||
auto pTemplate = m_World->GetComponent<Components::Template>(entity);
|
||||
|
||||
@@ -333,18 +338,22 @@ glm::vec3 dd::Systems::PhysicsSystem::VectorInterpolation(float timeProgress, st
|
||||
|
||||
bool dd::Systems::PhysicsSystem::OnPause(const dd::Events::Pause &event)
|
||||
{
|
||||
if (event.Type != "PhysicsSystem" && event.Type != "All") {
|
||||
/*if (event.Type != "PhysicsSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_Pause) {
|
||||
m_Pause = false;
|
||||
} else {
|
||||
m_Pause = true;
|
||||
}
|
||||
}*/
|
||||
m_Pause = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::PhysicsSystem::OnResume(const dd::Events::Resume &event)
|
||||
{
|
||||
/*if (event.Type != "PhysicsSystem" && event.Type != "All") {
|
||||
return false;
|
||||
}*/
|
||||
m_Pause = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void dd::Systems::PhysicsSystem::OnEntityCommit(EntityID entity)
|
||||
{
|
||||
auto physicsComponent = m_World->GetComponent<Components::Physics>(entity);
|
||||
|
||||
@@ -9,6 +9,7 @@ void dd::Systems::AnimationSystem::RegisterComponents(ComponentFactory* cf)
|
||||
void dd::Systems::AnimationSystem::Initialize()
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &AnimationSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &AnimationSystem::OnResume);
|
||||
}
|
||||
|
||||
void dd::Systems::AnimationSystem::Update(double dt)
|
||||
@@ -30,6 +31,12 @@ void dd::Systems::AnimationSystem::Update(double dt)
|
||||
|
||||
bool dd::Systems::AnimationSystem::OnPause(const Events::Pause& e)
|
||||
{
|
||||
m_Paused = !m_Paused;
|
||||
m_Paused = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::AnimationSystem::OnResume(const Events::Resume& e)
|
||||
{
|
||||
m_Paused = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user