Merge remote-tracking branch 'origin/master'

This commit is contained in:
2015-10-22 14:52:27 +02:00
23 changed files with 559 additions and 160 deletions
+8
View File
@@ -48,12 +48,15 @@
#include "Game/CLifebuoy.h"
#include "Game/CProjectile.h"
#include "Game/CBrick.h"
#include "Game/CBrickPart.h"
#include "Game/CWall.h"
#include "Game/CKraken.h"
#include "Game/CNewWaterVolume.h"
#include "Game/CBackground.h"
#include "Game/CTravels.h"
#include "Game/CStickyAim.h"
#include "Game/BallSystem.h"
#include "Game/LifeSystem.h"
#include "Game/HitLagSystem.h"
#include "Game/TravellingSystem.h"
#include "Game/LifebuoySystem.h"
@@ -151,8 +154,10 @@ public:
m_World->ComponentFactory.Register<Components::Physics>();
m_World->ComponentFactory.Register<Components::Ball>();
m_World->ComponentFactory.Register<Components::Brick>();
m_World->ComponentFactory.Register<Components::BrickPart>();
m_World->ComponentFactory.Register<Components::Pad>();
m_World->ComponentFactory.Register<Components::Wall>();
m_World->ComponentFactory.Register<Components::NewWaterVolume>();
m_World->ComponentFactory.Register<Components::Background>();
m_World->ComponentFactory.Register<Components::Life>();
m_World->ComponentFactory.Register<Components::Lifebuoy>();
@@ -204,6 +209,9 @@ public:
m_World->SystemFactory.Register<Systems::WaterSystem>(
[this]() { return new Systems::WaterSystem(m_World.get(), m_EventBroker); });
m_World->AddSystem<Systems::WaterSystem>();
m_World->SystemFactory.Register<Systems::LifeSystem>(
[this]() { return new Systems::LifeSystem(m_World.get(), m_EventBroker); });
m_World->AddSystem<Systems::LifeSystem>();
m_World->ComponentFactory.Register<Components::Model>();
m_World->ComponentFactory.Register<Components::Template>();
+18 -10
View File
@@ -1,6 +1,8 @@
#ifndef DAYDREAM_BALLSYSTEM_H
#define DAYDREAM_BALLSYSTEM_H
#include <random>
#include "Core/System.h"
#include "Core/World.h"
#include "Core/EventBroker.h"
@@ -8,14 +10,17 @@
#include "Core/CTemplate.h"
#include "Core/ResourceManager.h"
#include "Core/ConfigFile.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Physics/CRectangleShape.h"
#include "Physics/EContact.h"
#include "Rendering/CModel.h"
#include "Rendering/CSprite.h"
#include "Rendering/CPointLight.h"
#include "Rendering/CAnimation.h"
#include "Game/CBall.h"
#include "Game/CPowerUp.h"
#include "Game/CLife.h"
@@ -30,6 +35,8 @@
#include "Game/EStickyAttachedToPad.h"
#include "Game/EInkBlaster.h"
#include "Game/EInkBlasterOver.h"
#include "Game/EKrakenAttack.h"
#include "Game/EKrakenAttackEnd.h"
#include "Game/EStageCleared.h"
#include "Game/EArrivedAtNewStage.h"
#include "Game/EGameOver.h"
@@ -39,6 +46,7 @@
#include "Game/EHitLag.h"
#include "Game/EActionButton.h"
#include "Game/ELifebuoyHit.h"
#include "Physics/ECreateParticleSequence.h"
#include "Sound/CCollisionSound.h"
@@ -75,7 +83,6 @@ public:
void OnEntityRemoved(EntityID entity) override;
EntityID CreateBall();
void CreateLife(int);
EntityID Ball() { return m_Ball; };
void SetBall(const EntityID& ball) { m_Ball = ball; }
@@ -87,22 +94,18 @@ public:
void SetEdgeY(const float& edgeY) { m_EdgeY = edgeY; }
int& MultiBalls() { return m_MultiBalls; }
void SetMultiBalls(const int& multiBalls) { m_MultiBalls = multiBalls; }
int& Lives() { return m_Lives; }
void SetLives(const int& lives) { m_Lives = lives; }
int& PastLives() { return m_PastLives; }
void SetPastLives(const int& pastLives) { m_PastLives = pastLives; }
bool ReplaceBall() const { return m_ReplaceBall; }
void SetReplaceBall(const bool& replaceBall) { m_ReplaceBall = replaceBall; }
bool IsPaused() const { return m_Pause; }
void SetPause(const bool& pause) { m_Pause = pause; }
private:
std::mt19937 m_RandomGenerator;
float m_XMovementMultiplier = 2.f;
float m_EdgeX = 3.4f; //Actually 3.2, but anyways.
float m_EdgeY = 5.2f;
int m_MultiBalls = 0;
int m_Lives = 3;
int m_PastLives = 3;
bool m_ReplaceBall = false;
bool m_Pause = false;
bool m_Waiting = true;
@@ -110,9 +113,12 @@ private:
bool m_InkBlaster = false;
bool m_InkAttached = false;
bool m_InkBlockedWaiting = false;
bool m_KrakenAttack = false;
double m_KrakenCharge = 0;
bool m_Restarting = false;
int m_StickyCounter = 3;
bool m_GodMode = false;
bool m_First = true;
bool m_StageBlockedWaiting = false;
@@ -124,13 +130,14 @@ private:
std::unordered_map<EntityID, std::list<glm::vec2>> m_Contacts;
void ResolveContacts();
dd::EventRelay<BallSystem, dd::Events::LifeLost> m_ELifeLost;
dd::EventRelay<BallSystem, dd::Events::MultiBallLost> m_EMultiBallLost;
dd::EventRelay<BallSystem, dd::Events::ResetBall> m_EResetBall;
dd::EventRelay<BallSystem, dd::Events::MultiBall> m_EMultiBall;
dd::EventRelay<BallSystem, dd::Events::StickyPad> m_EStickyPad;
dd::EventRelay<BallSystem, dd::Events::InkBlaster> m_EInkBlaster;
dd::EventRelay<BallSystem, dd::Events::InkBlasterOver> m_EInkBlasterOver;
dd::EventRelay<BallSystem, dd::Events::KrakenAttack> m_EKrakenAttack;
dd::EventRelay<BallSystem, dd::Events::KrakenAttackEnd> m_EKrakenAttackEnd;
dd::EventRelay<BallSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<BallSystem, dd::Events::Resume> m_EResume;
dd::EventRelay<BallSystem, dd::Events::Contact> m_Contact;
@@ -139,13 +146,14 @@ private:
dd::EventRelay<BallSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage;
bool Contact(const Events::Contact &event);
bool OnLifeLost(const dd::Events::LifeLost &event);
bool OnMultiBallLost(const dd::Events::MultiBallLost &event);
bool OnResetBall(const dd::Events::ResetBall &event);
bool OnMultiBall(const dd::Events::MultiBall &event);
bool OnStickyPad(const dd::Events::StickyPad &event);
bool OnInkBlaster(const dd::Events::InkBlaster &event);
bool OnInkBlasterOver(const dd::Events::InkBlasterOver &event);
bool OnKrakenAttack(const dd::Events::KrakenAttack &event);
bool OnKrakenAttackEnd(const dd::Events::KrakenAttackEnd &event);
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnActionButton(const dd::Events::ActionButton &event);
+1 -1
View File
@@ -23,7 +23,7 @@ struct Ball : Component
bool InkBlaster = false;
bool Sticky = false;
glm::vec3 StickyPlacement = glm::vec3(0, 0, 0);
glm::vec3 SavedSpeed = glm::vec3(0, 0, 0);
glm::vec3 SavedSpeed = glm::vec3(0, 1, 0);
};
}
+26
View File
@@ -0,0 +1,26 @@
//
// Created by Adniklastrator on 2015-10-21.
//
#ifndef DAYDREAM_CBRICKPART_H
#define DAYDREAM_CBRICKPART_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct BrickPart : Component
{
bool Submerged = false;
int NumberOfPartsInBrick;
};
}
}
#endif //DAYDREAM_CBRICKPART_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-22.
//
#ifndef CNEWWATERVOLUME_H
#define CNEWWATERVOLUME_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct NewWaterVolume : public Component
{
};
}
}
#endif //DAYDREAM_NEWWATERVOLUME_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-21.
//
#ifndef DAYDREAM_EKRAKENATTACKEND_H
#define DAYDREAM_EKRAKENATTACKEND_H
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct KrakenAttackEnd : Event
{
};
}
}
#endif //DAYDREAM_EKRAKENATTACKEND_H
+9
View File
@@ -51,6 +51,7 @@ public:
EVENT_SUBSCRIBE_MEMBER(m_EGameOver, &HUD::OnGameOver);
EVENT_SUBSCRIBE_MEMBER(m_ClusterClear, &HUD::OnClusterClear);
EVENT_SUBSCRIBE_MEMBER(m_KrakenAttack, &HUD::OnKrakenAttack);
EVENT_SUBSCRIBE_MEMBER(m_KrakenAttackEnd, &HUD::OnKrakenAttackEnd);
updateScore();
}
@@ -71,6 +72,7 @@ private:
EventRelay<Frame, Events::GameOver> m_EGameOver;
EventRelay<Frame, Events::ClusterClear> m_ClusterClear;
EventRelay<Frame, Events::KrakenAttack> m_KrakenAttack;
EventRelay<Frame, Events::KrakenAttackEnd> m_KrakenAttackEnd;
void updateScore()
{
@@ -122,6 +124,13 @@ private:
return true;
}
bool OnKrakenAttackEnd(const Events::KrakenAttackEnd& event)
{
m_KrakenAttackSlider->Hide();
return true;
}
};
}
+3
View File
@@ -21,6 +21,8 @@
#include "Physics/ECreateParticleSequence.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/EComboEvent.h"
#include "Game/EScoreEvent.h"
#include "Game/EKrakenAppear.h"
#include "Game/EKrakenAttack.h"
#include "Game/EKrakenHit.h"
@@ -29,6 +31,7 @@
#include "Game/CTravels.h"
#include "Game/CKraken.h"
#include "Game/CBall.h"
#include "Game/CProjectile.h"
#include "Sound/CCollisionSound.h"
//#include "Core/Camera.h" Camera Component
+2 -1
View File
@@ -23,6 +23,7 @@
#include "Transform/EMove.h"
#include "Game/CBrick.h"
#include "Game/CBrickPart.h"
#include "Game/CBall.h"
#include "Game/CLife.h"
#include "Game/CWall.h"
@@ -211,7 +212,7 @@ private:
void GetNextLevel();
void SetBrokenModel(EntityID entity);
void CreateBrokenModelPart(EntityID Parent, std::string ModelPath, glm::vec3 RelativePosition, glm::vec2 Hitbox);
void CreateBrokenModelPart(EntityID Parent, std::string ModelPath, glm::vec3 RelativePosition, glm::vec2 Hitbox, int NumberOfParts);
};
}
+75
View File
@@ -0,0 +1,75 @@
//
// Created by Adniklastrator on 2015-10-22.
//
#ifndef DAYDREAM_LIFESYSTEM_H
#define DAYDREAM_LIFESYSTEM_H
#include "Core/System.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Core/ConfigFile.h"
#include "Transform/EMove.h"
#include "Rendering/CModel.h"
#include "Game/CLife.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/ELifeLost.h"
#include "Game/EGameOver.h"
#include "Game/EKrakenAttackEnd.h"
namespace dd
{
namespace Systems
{
class LifeSystem : public System
{
public:
LifeSystem(World* world, std::shared_ptr<dd::EventBroker> eventBroker)
: System(world, eventBroker)
{ }
void Initialize() override;
void Update(double dt) override;
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
bool IsPaused() const { return m_Pause; }
void SetPause(const bool& pause) { m_Pause = pause; }
int& Lives() { return m_Lives; }
void SetLives(const int& lives) { m_Lives = lives; }
int& PastLives() { return m_PastLives; }
void SetPastLives(const int& pastLives) { m_PastLives = pastLives; }
private:
bool m_Pause = false;
int m_Lives = 3;
int m_PastLives = 3;
bool m_GodMode = false;
void CreateLife(int);
dd::EventRelay<LifeSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<LifeSystem, dd::Events::Resume> m_EResume;
dd::EventRelay<LifeSystem, dd::Events::LifeLost> m_ELifeLost;
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnLifeLost(const dd::Events::LifeLost &event);
};
}
}
#endif //DAYDREAM_LIFESYSTEM_H
+8 -1
View File
@@ -43,6 +43,7 @@
#include "Game/EStickyAttachedToPad.h"
#include "Game/EInkBlaster.h"
#include "Game/EKrakenAttack.h"
#include "Game/EKrakenAttackEnd.h"
#include "Game/EPowerUpTaken.h"
#include "Game/EStageCleared.h"
#include "Game/EPause.h"
@@ -104,7 +105,11 @@ private:
double m_KrakenStrength = 0;
double m_PlayerStrength = 0;
float m_Edge = 2.8f;
EntityID m_KrakenArm;
float m_PadOriginalHeight = -4.8;
float m_PadHeight = m_PadOriginalHeight;
EntityID m_KrakenArm = NULL;
EntityID m_KrakenArmHitbox = NULL;
float m_PadRiseSpeed = 0.2;
Components::Transform* m_Transform = nullptr;
Components::Pad* m_Pad = nullptr;
std::shared_ptr<Components::Transform> m_StickTransform;
@@ -125,6 +130,7 @@ private:
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::KrakenAttackEnd> m_EKrakenAttackEnd;
dd::EventRelay<PadSystem, dd::Events::StickyPad> m_EStickyPad;
dd::EventRelay<PadSystem, dd::Events::StickyAttachedToPad> m_EStickyAttachedToPad;
dd::EventRelay<PadSystem, dd::Events::ActionButton> m_EActionButton;
@@ -142,6 +148,7 @@ private:
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnKrakenAttack(const dd::Events::KrakenAttack &event);
bool OnKrakenAttackEnd(const dd::Events::KrakenAttackEnd &event);
bool OnStickyPad(const dd::Events::StickyPad &event);
bool OnStickyAttachedToPad(const dd::Events::StickyAttachedToPad &event);
bool OnActionButton(const dd::Events::ActionButton &event);
+7
View File
@@ -19,6 +19,8 @@
#include "Game/EResume.h"
#include "Game/EInkBlaster.h"
#include "Game/EInkBlasterOver.h"
#include "Game/EKrakenAttack.h"
#include "Game/EKrakenAttackEnd.h"
#include "Game/EActionButton.h"
#include "Game/EHitPad.h"
#include "Game/CProjectile.h"
@@ -52,6 +54,7 @@ private:
bool m_Pause = false;
bool m_InkBlaster = false;
bool m_SquidLoaded = false;
bool m_KrakenAttack = false;
int m_Shots = 0;
float m_InkBlasterSpeed = 5;
EntityID m_InkBlastTemplate;
@@ -61,6 +64,8 @@ private:
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::KrakenAttack> m_EKrakenAttack;
dd::EventRelay<ProjectileSystem, dd::Events::KrakenAttackEnd> m_EKrakenAttackEnd;
dd::EventRelay<ProjectileSystem, dd::Events::HitPad> m_EHitPad;
dd::EventRelay<ProjectileSystem, dd::Events::ActionButton> m_EActionButton;
@@ -68,6 +73,8 @@ private:
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnInkBlaster(const dd::Events::InkBlaster &event);
bool OnKrakenAttack(const dd::Events::KrakenAttack &event);
bool OnKrakenAttackEnd(const dd::Events::KrakenAttackEnd &event);
bool OnHitPad(const dd::Events::HitPad &event);
bool OnActionButton(const dd::Events::ActionButton &event);
};
+1
View File
@@ -18,6 +18,7 @@
#include "Game/EStageCleared.h"
#include "Game/CTravels.h"
#include "Game/CBackground.h"
#include "Game/CNewWaterVolume.h"
namespace dd
+11
View File
@@ -11,9 +11,13 @@
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Core/ConfigFile.h"
#include "Transform/EMove.h"
#include "Physics/CPhysics.h"
#include "Physics/CWaterVolume.h"
#include "Physics/CRectangleShape.h"
#include "Game/CBrickPart.h"
#include "Game/CNewWaterVolume.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/ERelevantObjectCreated.h"
@@ -47,6 +51,13 @@ public:
private:
bool m_Pause = false;
EntityID m_BottomWall = 0;
float m_SubmergedOriginalHeight = -4.5;
float m_SubmergedHeight = m_SubmergedOriginalHeight;
bool m_RaiseWater = false;
bool m_RemoveWater = false;
std::array<int, 10> m_BrickPartCounters;
dd::EventRelay<WaterSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<WaterSystem, dd::Events::Resume> m_EResume;