Merge remote-tracking branch 'origin/master'
This commit is contained in:
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
@@ -48,12 +48,15 @@
|
|||||||
#include "Game/CLifebuoy.h"
|
#include "Game/CLifebuoy.h"
|
||||||
#include "Game/CProjectile.h"
|
#include "Game/CProjectile.h"
|
||||||
#include "Game/CBrick.h"
|
#include "Game/CBrick.h"
|
||||||
|
#include "Game/CBrickPart.h"
|
||||||
#include "Game/CWall.h"
|
#include "Game/CWall.h"
|
||||||
#include "Game/CKraken.h"
|
#include "Game/CKraken.h"
|
||||||
|
#include "Game/CNewWaterVolume.h"
|
||||||
#include "Game/CBackground.h"
|
#include "Game/CBackground.h"
|
||||||
#include "Game/CTravels.h"
|
#include "Game/CTravels.h"
|
||||||
#include "Game/CStickyAim.h"
|
#include "Game/CStickyAim.h"
|
||||||
#include "Game/BallSystem.h"
|
#include "Game/BallSystem.h"
|
||||||
|
#include "Game/LifeSystem.h"
|
||||||
#include "Game/HitLagSystem.h"
|
#include "Game/HitLagSystem.h"
|
||||||
#include "Game/TravellingSystem.h"
|
#include "Game/TravellingSystem.h"
|
||||||
#include "Game/LifebuoySystem.h"
|
#include "Game/LifebuoySystem.h"
|
||||||
@@ -151,8 +154,10 @@ public:
|
|||||||
m_World->ComponentFactory.Register<Components::Physics>();
|
m_World->ComponentFactory.Register<Components::Physics>();
|
||||||
m_World->ComponentFactory.Register<Components::Ball>();
|
m_World->ComponentFactory.Register<Components::Ball>();
|
||||||
m_World->ComponentFactory.Register<Components::Brick>();
|
m_World->ComponentFactory.Register<Components::Brick>();
|
||||||
|
m_World->ComponentFactory.Register<Components::BrickPart>();
|
||||||
m_World->ComponentFactory.Register<Components::Pad>();
|
m_World->ComponentFactory.Register<Components::Pad>();
|
||||||
m_World->ComponentFactory.Register<Components::Wall>();
|
m_World->ComponentFactory.Register<Components::Wall>();
|
||||||
|
m_World->ComponentFactory.Register<Components::NewWaterVolume>();
|
||||||
m_World->ComponentFactory.Register<Components::Background>();
|
m_World->ComponentFactory.Register<Components::Background>();
|
||||||
m_World->ComponentFactory.Register<Components::Life>();
|
m_World->ComponentFactory.Register<Components::Life>();
|
||||||
m_World->ComponentFactory.Register<Components::Lifebuoy>();
|
m_World->ComponentFactory.Register<Components::Lifebuoy>();
|
||||||
@@ -204,6 +209,9 @@ public:
|
|||||||
m_World->SystemFactory.Register<Systems::WaterSystem>(
|
m_World->SystemFactory.Register<Systems::WaterSystem>(
|
||||||
[this]() { return new Systems::WaterSystem(m_World.get(), m_EventBroker); });
|
[this]() { return new Systems::WaterSystem(m_World.get(), m_EventBroker); });
|
||||||
m_World->AddSystem<Systems::WaterSystem>();
|
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::Model>();
|
||||||
m_World->ComponentFactory.Register<Components::Template>();
|
m_World->ComponentFactory.Register<Components::Template>();
|
||||||
|
|||||||
+18
-10
@@ -1,6 +1,8 @@
|
|||||||
#ifndef DAYDREAM_BALLSYSTEM_H
|
#ifndef DAYDREAM_BALLSYSTEM_H
|
||||||
#define DAYDREAM_BALLSYSTEM_H
|
#define DAYDREAM_BALLSYSTEM_H
|
||||||
|
|
||||||
|
#include <random>
|
||||||
|
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "Core/World.h"
|
#include "Core/World.h"
|
||||||
#include "Core/EventBroker.h"
|
#include "Core/EventBroker.h"
|
||||||
@@ -8,14 +10,17 @@
|
|||||||
#include "Core/CTemplate.h"
|
#include "Core/CTemplate.h"
|
||||||
#include "Core/ResourceManager.h"
|
#include "Core/ResourceManager.h"
|
||||||
#include "Core/ConfigFile.h"
|
#include "Core/ConfigFile.h"
|
||||||
|
|
||||||
#include "Physics/CPhysics.h"
|
#include "Physics/CPhysics.h"
|
||||||
#include "Physics/CCircleShape.h"
|
#include "Physics/CCircleShape.h"
|
||||||
#include "Physics/CRectangleShape.h"
|
#include "Physics/CRectangleShape.h"
|
||||||
#include "Physics/EContact.h"
|
#include "Physics/EContact.h"
|
||||||
|
|
||||||
#include "Rendering/CModel.h"
|
#include "Rendering/CModel.h"
|
||||||
#include "Rendering/CSprite.h"
|
#include "Rendering/CSprite.h"
|
||||||
#include "Rendering/CPointLight.h"
|
#include "Rendering/CPointLight.h"
|
||||||
#include "Rendering/CAnimation.h"
|
#include "Rendering/CAnimation.h"
|
||||||
|
|
||||||
#include "Game/CBall.h"
|
#include "Game/CBall.h"
|
||||||
#include "Game/CPowerUp.h"
|
#include "Game/CPowerUp.h"
|
||||||
#include "Game/CLife.h"
|
#include "Game/CLife.h"
|
||||||
@@ -30,6 +35,8 @@
|
|||||||
#include "Game/EStickyAttachedToPad.h"
|
#include "Game/EStickyAttachedToPad.h"
|
||||||
#include "Game/EInkBlaster.h"
|
#include "Game/EInkBlaster.h"
|
||||||
#include "Game/EInkBlasterOver.h"
|
#include "Game/EInkBlasterOver.h"
|
||||||
|
#include "Game/EKrakenAttack.h"
|
||||||
|
#include "Game/EKrakenAttackEnd.h"
|
||||||
#include "Game/EStageCleared.h"
|
#include "Game/EStageCleared.h"
|
||||||
#include "Game/EArrivedAtNewStage.h"
|
#include "Game/EArrivedAtNewStage.h"
|
||||||
#include "Game/EGameOver.h"
|
#include "Game/EGameOver.h"
|
||||||
@@ -39,6 +46,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"
|
#include "Physics/ECreateParticleSequence.h"
|
||||||
#include "Sound/CCollisionSound.h"
|
#include "Sound/CCollisionSound.h"
|
||||||
|
|
||||||
@@ -75,7 +83,6 @@ public:
|
|||||||
void OnEntityRemoved(EntityID entity) override;
|
void OnEntityRemoved(EntityID entity) override;
|
||||||
|
|
||||||
EntityID CreateBall();
|
EntityID CreateBall();
|
||||||
void CreateLife(int);
|
|
||||||
EntityID Ball() { return m_Ball; };
|
EntityID Ball() { return m_Ball; };
|
||||||
void SetBall(const EntityID& ball) { m_Ball = ball; }
|
void SetBall(const EntityID& ball) { m_Ball = ball; }
|
||||||
|
|
||||||
@@ -87,22 +94,18 @@ public:
|
|||||||
void SetEdgeY(const float& edgeY) { m_EdgeY = edgeY; }
|
void SetEdgeY(const float& edgeY) { m_EdgeY = edgeY; }
|
||||||
int& MultiBalls() { return m_MultiBalls; }
|
int& MultiBalls() { return m_MultiBalls; }
|
||||||
void SetMultiBalls(const int& multiBalls) { m_MultiBalls = 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; }
|
bool ReplaceBall() const { return m_ReplaceBall; }
|
||||||
void SetReplaceBall(const bool& replaceBall) { m_ReplaceBall = replaceBall; }
|
void SetReplaceBall(const bool& replaceBall) { m_ReplaceBall = replaceBall; }
|
||||||
bool IsPaused() const { return m_Pause; }
|
bool IsPaused() const { return m_Pause; }
|
||||||
void SetPause(const bool& pause) { m_Pause = pause; }
|
void SetPause(const bool& pause) { m_Pause = pause; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::mt19937 m_RandomGenerator;
|
||||||
|
|
||||||
float m_XMovementMultiplier = 2.f;
|
float m_XMovementMultiplier = 2.f;
|
||||||
float m_EdgeX = 3.4f; //Actually 3.2, but anyways.
|
float m_EdgeX = 3.4f; //Actually 3.2, but anyways.
|
||||||
float m_EdgeY = 5.2f;
|
float m_EdgeY = 5.2f;
|
||||||
int m_MultiBalls = 0;
|
int m_MultiBalls = 0;
|
||||||
int m_Lives = 3;
|
|
||||||
int m_PastLives = 3;
|
|
||||||
bool m_ReplaceBall = false;
|
bool m_ReplaceBall = false;
|
||||||
bool m_Pause = false;
|
bool m_Pause = false;
|
||||||
bool m_Waiting = true;
|
bool m_Waiting = true;
|
||||||
@@ -110,9 +113,12 @@ private:
|
|||||||
bool m_InkBlaster = false;
|
bool m_InkBlaster = false;
|
||||||
bool m_InkAttached = false;
|
bool m_InkAttached = false;
|
||||||
bool m_InkBlockedWaiting = false;
|
bool m_InkBlockedWaiting = false;
|
||||||
|
bool m_KrakenAttack = false;
|
||||||
|
double m_KrakenCharge = 0;
|
||||||
bool m_Restarting = false;
|
bool m_Restarting = false;
|
||||||
int m_StickyCounter = 3;
|
int m_StickyCounter = 3;
|
||||||
bool m_GodMode = false;
|
|
||||||
|
bool m_First = true;
|
||||||
|
|
||||||
bool m_StageBlockedWaiting = false;
|
bool m_StageBlockedWaiting = false;
|
||||||
|
|
||||||
@@ -124,13 +130,14 @@ private:
|
|||||||
std::unordered_map<EntityID, std::list<glm::vec2>> m_Contacts;
|
std::unordered_map<EntityID, std::list<glm::vec2>> m_Contacts;
|
||||||
void ResolveContacts();
|
void ResolveContacts();
|
||||||
|
|
||||||
dd::EventRelay<BallSystem, dd::Events::LifeLost> m_ELifeLost;
|
|
||||||
dd::EventRelay<BallSystem, dd::Events::MultiBallLost> m_EMultiBallLost;
|
dd::EventRelay<BallSystem, dd::Events::MultiBallLost> m_EMultiBallLost;
|
||||||
dd::EventRelay<BallSystem, dd::Events::ResetBall> m_EResetBall;
|
dd::EventRelay<BallSystem, dd::Events::ResetBall> m_EResetBall;
|
||||||
dd::EventRelay<BallSystem, dd::Events::MultiBall> m_EMultiBall;
|
dd::EventRelay<BallSystem, dd::Events::MultiBall> m_EMultiBall;
|
||||||
dd::EventRelay<BallSystem, dd::Events::StickyPad> m_EStickyPad;
|
dd::EventRelay<BallSystem, dd::Events::StickyPad> m_EStickyPad;
|
||||||
dd::EventRelay<BallSystem, dd::Events::InkBlaster> m_EInkBlaster;
|
dd::EventRelay<BallSystem, dd::Events::InkBlaster> m_EInkBlaster;
|
||||||
dd::EventRelay<BallSystem, dd::Events::InkBlasterOver> m_EInkBlasterOver;
|
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::Pause> m_EPause;
|
||||||
dd::EventRelay<BallSystem, dd::Events::Resume> m_EResume;
|
dd::EventRelay<BallSystem, dd::Events::Resume> m_EResume;
|
||||||
dd::EventRelay<BallSystem, dd::Events::Contact> m_Contact;
|
dd::EventRelay<BallSystem, dd::Events::Contact> m_Contact;
|
||||||
@@ -139,13 +146,14 @@ private:
|
|||||||
dd::EventRelay<BallSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage;
|
dd::EventRelay<BallSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage;
|
||||||
|
|
||||||
bool Contact(const Events::Contact &event);
|
bool Contact(const Events::Contact &event);
|
||||||
bool OnLifeLost(const dd::Events::LifeLost &event);
|
|
||||||
bool OnMultiBallLost(const dd::Events::MultiBallLost &event);
|
bool OnMultiBallLost(const dd::Events::MultiBallLost &event);
|
||||||
bool OnResetBall(const dd::Events::ResetBall &event);
|
bool OnResetBall(const dd::Events::ResetBall &event);
|
||||||
bool OnMultiBall(const dd::Events::MultiBall &event);
|
bool OnMultiBall(const dd::Events::MultiBall &event);
|
||||||
bool OnStickyPad(const dd::Events::StickyPad &event);
|
bool OnStickyPad(const dd::Events::StickyPad &event);
|
||||||
bool OnInkBlaster(const dd::Events::InkBlaster &event);
|
bool OnInkBlaster(const dd::Events::InkBlaster &event);
|
||||||
bool OnInkBlasterOver(const dd::Events::InkBlasterOver &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 OnPause(const dd::Events::Pause &event);
|
||||||
bool OnResume(const dd::Events::Resume &event);
|
bool OnResume(const dd::Events::Resume &event);
|
||||||
bool OnActionButton(const dd::Events::ActionButton &event);
|
bool OnActionButton(const dd::Events::ActionButton &event);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ struct Ball : Component
|
|||||||
bool InkBlaster = false;
|
bool InkBlaster = false;
|
||||||
bool Sticky = false;
|
bool Sticky = false;
|
||||||
glm::vec3 StickyPlacement = glm::vec3(0, 0, 0);
|
glm::vec3 StickyPlacement = glm::vec3(0, 0, 0);
|
||||||
glm::vec3 SavedSpeed = glm::vec3(0, 0, 0);
|
glm::vec3 SavedSpeed = glm::vec3(0, 1, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -51,6 +51,7 @@ public:
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EGameOver, &HUD::OnGameOver);
|
EVENT_SUBSCRIBE_MEMBER(m_EGameOver, &HUD::OnGameOver);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ClusterClear, &HUD::OnClusterClear);
|
EVENT_SUBSCRIBE_MEMBER(m_ClusterClear, &HUD::OnClusterClear);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_KrakenAttack, &HUD::OnKrakenAttack);
|
EVENT_SUBSCRIBE_MEMBER(m_KrakenAttack, &HUD::OnKrakenAttack);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_KrakenAttackEnd, &HUD::OnKrakenAttackEnd);
|
||||||
|
|
||||||
updateScore();
|
updateScore();
|
||||||
}
|
}
|
||||||
@@ -71,6 +72,7 @@ private:
|
|||||||
EventRelay<Frame, Events::GameOver> m_EGameOver;
|
EventRelay<Frame, Events::GameOver> m_EGameOver;
|
||||||
EventRelay<Frame, Events::ClusterClear> m_ClusterClear;
|
EventRelay<Frame, Events::ClusterClear> m_ClusterClear;
|
||||||
EventRelay<Frame, Events::KrakenAttack> m_KrakenAttack;
|
EventRelay<Frame, Events::KrakenAttack> m_KrakenAttack;
|
||||||
|
EventRelay<Frame, Events::KrakenAttackEnd> m_KrakenAttackEnd;
|
||||||
|
|
||||||
void updateScore()
|
void updateScore()
|
||||||
{
|
{
|
||||||
@@ -122,6 +124,13 @@ private:
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OnKrakenAttackEnd(const Events::KrakenAttackEnd& event)
|
||||||
|
{
|
||||||
|
m_KrakenAttackSlider->Hide();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
#include "Physics/ECreateParticleSequence.h"
|
#include "Physics/ECreateParticleSequence.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
#include "Game/EResume.h"
|
#include "Game/EResume.h"
|
||||||
|
#include "Game/EComboEvent.h"
|
||||||
|
#include "Game/EScoreEvent.h"
|
||||||
#include "Game/EKrakenAppear.h"
|
#include "Game/EKrakenAppear.h"
|
||||||
#include "Game/EKrakenAttack.h"
|
#include "Game/EKrakenAttack.h"
|
||||||
#include "Game/EKrakenHit.h"
|
#include "Game/EKrakenHit.h"
|
||||||
@@ -29,6 +31,7 @@
|
|||||||
#include "Game/CTravels.h"
|
#include "Game/CTravels.h"
|
||||||
#include "Game/CKraken.h"
|
#include "Game/CKraken.h"
|
||||||
#include "Game/CBall.h"
|
#include "Game/CBall.h"
|
||||||
|
#include "Game/CProjectile.h"
|
||||||
#include "Sound/CCollisionSound.h"
|
#include "Sound/CCollisionSound.h"
|
||||||
//#include "Core/Camera.h" Camera Component
|
//#include "Core/Camera.h" Camera Component
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "Transform/EMove.h"
|
#include "Transform/EMove.h"
|
||||||
|
|
||||||
#include "Game/CBrick.h"
|
#include "Game/CBrick.h"
|
||||||
|
#include "Game/CBrickPart.h"
|
||||||
#include "Game/CBall.h"
|
#include "Game/CBall.h"
|
||||||
#include "Game/CLife.h"
|
#include "Game/CLife.h"
|
||||||
#include "Game/CWall.h"
|
#include "Game/CWall.h"
|
||||||
@@ -211,7 +212,7 @@ private:
|
|||||||
|
|
||||||
void GetNextLevel();
|
void GetNextLevel();
|
||||||
void SetBrokenModel(EntityID entity);
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
#include "Game/EStickyAttachedToPad.h"
|
#include "Game/EStickyAttachedToPad.h"
|
||||||
#include "Game/EInkBlaster.h"
|
#include "Game/EInkBlaster.h"
|
||||||
#include "Game/EKrakenAttack.h"
|
#include "Game/EKrakenAttack.h"
|
||||||
|
#include "Game/EKrakenAttackEnd.h"
|
||||||
#include "Game/EPowerUpTaken.h"
|
#include "Game/EPowerUpTaken.h"
|
||||||
#include "Game/EStageCleared.h"
|
#include "Game/EStageCleared.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
@@ -104,7 +105,11 @@ private:
|
|||||||
double m_KrakenStrength = 0;
|
double m_KrakenStrength = 0;
|
||||||
double m_PlayerStrength = 0;
|
double m_PlayerStrength = 0;
|
||||||
float m_Edge = 2.8f;
|
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::Transform* m_Transform = nullptr;
|
||||||
Components::Pad* m_Pad = nullptr;
|
Components::Pad* m_Pad = nullptr;
|
||||||
std::shared_ptr<Components::Transform> m_StickTransform;
|
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::Pause> m_EPause;
|
||||||
dd::EventRelay<PadSystem, dd::Events::Resume> m_EResume;
|
dd::EventRelay<PadSystem, dd::Events::Resume> m_EResume;
|
||||||
dd::EventRelay<PadSystem, dd::Events::KrakenAttack> m_EKrakenAttack;
|
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::StickyPad> m_EStickyPad;
|
||||||
dd::EventRelay<PadSystem, dd::Events::StickyAttachedToPad> m_EStickyAttachedToPad;
|
dd::EventRelay<PadSystem, dd::Events::StickyAttachedToPad> m_EStickyAttachedToPad;
|
||||||
dd::EventRelay<PadSystem, dd::Events::ActionButton> m_EActionButton;
|
dd::EventRelay<PadSystem, dd::Events::ActionButton> m_EActionButton;
|
||||||
@@ -142,6 +148,7 @@ private:
|
|||||||
bool OnPause(const dd::Events::Pause &event);
|
bool OnPause(const dd::Events::Pause &event);
|
||||||
bool OnResume(const dd::Events::Resume &event);
|
bool OnResume(const dd::Events::Resume &event);
|
||||||
bool OnKrakenAttack(const dd::Events::KrakenAttack &event);
|
bool OnKrakenAttack(const dd::Events::KrakenAttack &event);
|
||||||
|
bool OnKrakenAttackEnd(const dd::Events::KrakenAttackEnd &event);
|
||||||
bool OnStickyPad(const dd::Events::StickyPad &event);
|
bool OnStickyPad(const dd::Events::StickyPad &event);
|
||||||
bool OnStickyAttachedToPad(const dd::Events::StickyAttachedToPad &event);
|
bool OnStickyAttachedToPad(const dd::Events::StickyAttachedToPad &event);
|
||||||
bool OnActionButton(const dd::Events::ActionButton &event);
|
bool OnActionButton(const dd::Events::ActionButton &event);
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
#include "Game/EResume.h"
|
#include "Game/EResume.h"
|
||||||
#include "Game/EInkBlaster.h"
|
#include "Game/EInkBlaster.h"
|
||||||
#include "Game/EInkBlasterOver.h"
|
#include "Game/EInkBlasterOver.h"
|
||||||
|
#include "Game/EKrakenAttack.h"
|
||||||
|
#include "Game/EKrakenAttackEnd.h"
|
||||||
#include "Game/EActionButton.h"
|
#include "Game/EActionButton.h"
|
||||||
#include "Game/EHitPad.h"
|
#include "Game/EHitPad.h"
|
||||||
#include "Game/CProjectile.h"
|
#include "Game/CProjectile.h"
|
||||||
@@ -52,6 +54,7 @@ private:
|
|||||||
bool m_Pause = false;
|
bool m_Pause = false;
|
||||||
bool m_InkBlaster = false;
|
bool m_InkBlaster = false;
|
||||||
bool m_SquidLoaded = false;
|
bool m_SquidLoaded = false;
|
||||||
|
bool m_KrakenAttack = false;
|
||||||
int m_Shots = 0;
|
int m_Shots = 0;
|
||||||
float m_InkBlasterSpeed = 5;
|
float m_InkBlasterSpeed = 5;
|
||||||
EntityID m_InkBlastTemplate;
|
EntityID m_InkBlastTemplate;
|
||||||
@@ -61,6 +64,8 @@ private:
|
|||||||
dd::EventRelay<ProjectileSystem, dd::Events::Pause> m_EPause;
|
dd::EventRelay<ProjectileSystem, dd::Events::Pause> m_EPause;
|
||||||
dd::EventRelay<ProjectileSystem, dd::Events::Resume> m_EResume;
|
dd::EventRelay<ProjectileSystem, dd::Events::Resume> m_EResume;
|
||||||
dd::EventRelay<ProjectileSystem, dd::Events::InkBlaster> m_EInkBlaster;
|
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::HitPad> m_EHitPad;
|
||||||
dd::EventRelay<ProjectileSystem, dd::Events::ActionButton> m_EActionButton;
|
dd::EventRelay<ProjectileSystem, dd::Events::ActionButton> m_EActionButton;
|
||||||
|
|
||||||
@@ -68,6 +73,8 @@ private:
|
|||||||
bool OnPause(const dd::Events::Pause &event);
|
bool OnPause(const dd::Events::Pause &event);
|
||||||
bool OnResume(const dd::Events::Resume &event);
|
bool OnResume(const dd::Events::Resume &event);
|
||||||
bool OnInkBlaster(const dd::Events::InkBlaster &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 OnHitPad(const dd::Events::HitPad &event);
|
||||||
bool OnActionButton(const dd::Events::ActionButton &event);
|
bool OnActionButton(const dd::Events::ActionButton &event);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "Game/EStageCleared.h"
|
#include "Game/EStageCleared.h"
|
||||||
#include "Game/CTravels.h"
|
#include "Game/CTravels.h"
|
||||||
#include "Game/CBackground.h"
|
#include "Game/CBackground.h"
|
||||||
|
#include "Game/CNewWaterVolume.h"
|
||||||
|
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
|
|||||||
@@ -11,9 +11,13 @@
|
|||||||
#include "Core/CTemplate.h"
|
#include "Core/CTemplate.h"
|
||||||
#include "Core/EventBroker.h"
|
#include "Core/EventBroker.h"
|
||||||
#include "Core/World.h"
|
#include "Core/World.h"
|
||||||
|
#include "Core/ConfigFile.h"
|
||||||
#include "Transform/EMove.h"
|
#include "Transform/EMove.h"
|
||||||
|
#include "Physics/CPhysics.h"
|
||||||
#include "Physics/CWaterVolume.h"
|
#include "Physics/CWaterVolume.h"
|
||||||
#include "Physics/CRectangleShape.h"
|
#include "Physics/CRectangleShape.h"
|
||||||
|
#include "Game/CBrickPart.h"
|
||||||
|
#include "Game/CNewWaterVolume.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
#include "Game/EResume.h"
|
#include "Game/EResume.h"
|
||||||
#include "Game/ERelevantObjectCreated.h"
|
#include "Game/ERelevantObjectCreated.h"
|
||||||
@@ -47,6 +51,13 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool m_Pause = false;
|
bool m_Pause = false;
|
||||||
EntityID m_BottomWall = 0;
|
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::Pause> m_EPause;
|
||||||
dd::EventRelay<WaterSystem, dd::Events::Resume> m_EResume;
|
dd::EventRelay<WaterSystem, dd::Events::Resume> m_EResume;
|
||||||
|
|||||||
@@ -12,15 +12,17 @@ void dd::Systems::BallSystem::RegisterComponents(ComponentFactory *cf)
|
|||||||
|
|
||||||
void dd::Systems::BallSystem::Initialize()
|
void dd::Systems::BallSystem::Initialize()
|
||||||
{
|
{
|
||||||
|
std::random_device rd;
|
||||||
|
m_RandomGenerator = std::mt19937(rd());
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_Contact, &BallSystem::Contact);
|
EVENT_SUBSCRIBE_MEMBER(m_Contact, &BallSystem::Contact);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ELifeLost, &BallSystem::OnLifeLost);
|
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EMultiBallLost, &BallSystem::OnMultiBallLost);
|
EVENT_SUBSCRIBE_MEMBER(m_EMultiBallLost, &BallSystem::OnMultiBallLost);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EResetBall, &BallSystem::OnResetBall);
|
EVENT_SUBSCRIBE_MEMBER(m_EResetBall, &BallSystem::OnResetBall);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, &BallSystem::OnMultiBall);
|
EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, &BallSystem::OnMultiBall);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EStickyPad, &BallSystem::OnStickyPad);
|
EVENT_SUBSCRIBE_MEMBER(m_EStickyPad, &BallSystem::OnStickyPad);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EInkBlaster, &BallSystem::OnInkBlaster);
|
EVENT_SUBSCRIBE_MEMBER(m_EInkBlaster, &BallSystem::OnInkBlaster);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EInkBlasterOver, &BallSystem::OnInkBlasterOver);
|
EVENT_SUBSCRIBE_MEMBER(m_EInkBlasterOver, &BallSystem::OnInkBlasterOver);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &BallSystem::OnKrakenAttack);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttackEnd, &BallSystem::OnKrakenAttackEnd);
|
||||||
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_EResume, &BallSystem::OnResume);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &BallSystem::OnActionButton);
|
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &BallSystem::OnActionButton);
|
||||||
@@ -35,6 +37,7 @@ void dd::Systems::BallSystem::Initialize()
|
|||||||
transform->Position = glm::vec3(-20.f, 0.26f, -10.f);
|
transform->Position = glm::vec3(-20.f, 0.26f, -10.f);
|
||||||
transform->Scale = glm::vec3(0.3f, 0.3f, 0.3f);
|
transform->Scale = glm::vec3(0.3f, 0.3f, 0.3f);
|
||||||
transform->Velocity = glm::vec3(0.f, 0.f, 0.f);
|
transform->Velocity = glm::vec3(0.f, 0.f, 0.f);
|
||||||
|
transform->Orientation = glm::quat();
|
||||||
auto model = m_World->AddComponent<Components::Model>(ent);
|
auto model = m_World->AddComponent<Components::Model>(ent);
|
||||||
model->ModelFile = "Models/Sid/Sid.dae";
|
model->ModelFile = "Models/Sid/Sid.dae";
|
||||||
auto animation = m_World->AddComponent<Components::Animation>(ent);
|
auto animation = m_World->AddComponent<Components::Animation>(ent);
|
||||||
@@ -63,27 +66,11 @@ void dd::Systems::BallSystem::Initialize()
|
|||||||
transform2->Velocity = glm::vec3(0.0f, -10.f, 0.f);
|
transform2->Velocity = glm::vec3(0.0f, -10.f, 0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < Lives(); i++) {
|
SetReplaceBall(true);
|
||||||
CreateLife(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_GodMode = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<bool>("Cheat.GodMode", false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dd::Systems::BallSystem::Update(double dt)
|
void dd::Systems::BallSystem::Update(double dt)
|
||||||
{
|
{
|
||||||
if (Lives() == 0)
|
|
||||||
{
|
|
||||||
Events::GameOver e;
|
|
||||||
EventBroker->Publish(e);
|
|
||||||
|
|
||||||
Events::Pause p;
|
|
||||||
p.Type = "All";
|
|
||||||
EventBroker->Publish(p);
|
|
||||||
|
|
||||||
//TODO: Make this not so ugly
|
|
||||||
SetLives(-1);
|
|
||||||
}
|
|
||||||
ResolveContacts();
|
ResolveContacts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,36 +84,20 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
|
|
||||||
auto ballComponent = m_World->GetComponent<Components::Ball>(entity);
|
auto ballComponent = m_World->GetComponent<Components::Ball>(entity);
|
||||||
|
|
||||||
/*if (IsPaused()) {
|
|
||||||
if (ballComponent != nullptr) {
|
|
||||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
|
||||||
|
|
||||||
if (!ballComponent->Paused) {
|
|
||||||
ballComponent->Paused = true;
|
|
||||||
ballComponent->SavedSpeed = transform->Velocity;
|
|
||||||
transform->Velocity = glm::vec3(0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if (ballComponent != nullptr) {
|
|
||||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
|
||||||
|
|
||||||
if (ballComponent->Paused) {
|
|
||||||
transform->Velocity = ballComponent->SavedSpeed;
|
|
||||||
ballComponent->Paused = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
||||||
if (templateCheck != nullptr){ return; }
|
if (templateCheck != nullptr){ return; }
|
||||||
|
|
||||||
if (ballComponent != nullptr) {
|
if (ballComponent != nullptr) {
|
||||||
if (ReplaceBall()) {
|
if (ReplaceBall()) {
|
||||||
|
m_First = true;
|
||||||
SetReplaceBall(false);
|
SetReplaceBall(false);
|
||||||
m_Waiting = true;
|
m_Waiting = true;
|
||||||
|
std::uniform_real_distribution<float> dist(-0.5f, 0.5f);
|
||||||
|
float random = dist(m_RandomGenerator);
|
||||||
|
ballComponent->SavedSpeed = glm::vec3(random, 1, 0.f);
|
||||||
|
//ballComponent->SavedSpeed = glm::vec3(0.f, 1, 0.f);
|
||||||
ballComponent->Waiting = true;
|
ballComponent->Waiting = true;
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ballComponent->Waiting) {
|
if (ballComponent->Waiting) {
|
||||||
@@ -134,12 +105,18 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
m_Restarting = false;
|
m_Restarting = false;
|
||||||
ballComponent->Waiting = false;
|
ballComponent->Waiting = false;
|
||||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
transform->Velocity = glm::normalize(glm::vec3(0.5f, 1, 0.f)) * ballComponent->Speed;
|
/*std::uniform_real_distribution<float> dist(-0.5f, 0.5f);
|
||||||
|
float random = dist(m_RandomGenerator);*/
|
||||||
|
transform->Velocity = glm::normalize(ballComponent->SavedSpeed) * ballComponent->Speed;
|
||||||
|
//transform->Velocity = glm::normalize(glm::vec3(0, 1, 0)) * ballComponent->Speed;
|
||||||
} else if (!ballComponent->Sticky) {
|
} else if (!ballComponent->Sticky) {
|
||||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
transform->Velocity = glm::vec3(0.f, 0.f, 0.f);
|
transform->Velocity = glm::vec3(0.f, 0.f, 0.f);
|
||||||
//transform->Position = glm::vec3(0.0f, -3.f, -10.f);
|
//transform->Position = glm::vec3(0.0f, -3.f, -10.f);
|
||||||
transform->Orientation = glm::quat();
|
if (m_First) {
|
||||||
|
transform->Orientation = glm::quat();
|
||||||
|
m_First = false;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,7 +147,7 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
m_World->RemoveEntity(entity);
|
m_World->RemoveEntity(entity);
|
||||||
Events::MultiBallLost e;
|
Events::MultiBallLost e;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
} else if (Lives() == PastLives() && !m_Restarting) {
|
} else if (!m_Restarting) { //If we lose lives when we shouldn't, look here.
|
||||||
Events::ResetBall be;
|
Events::ResetBall be;
|
||||||
EventBroker->Publish(be);
|
EventBroker->Publish(be);
|
||||||
Events::LifeLost e;
|
Events::LifeLost e;
|
||||||
@@ -197,16 +174,6 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Lives() != PastLives()) {
|
|
||||||
auto life = m_World->GetComponent<Components::Life>(entity);
|
|
||||||
if (life != nullptr) {
|
|
||||||
if (life->Number + 1 == PastLives()) {
|
|
||||||
m_World->RemoveEntity(entity);
|
|
||||||
SetPastLives(Lives());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ballComponent != nullptr) {
|
if (ballComponent != nullptr) {
|
||||||
if (!ballComponent->Sticky)
|
if (!ballComponent->Sticky)
|
||||||
{
|
{
|
||||||
@@ -433,31 +400,6 @@ EntityID dd::Systems::BallSystem::CreateBall()
|
|||||||
return ent;
|
return ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dd::Systems::BallSystem::CreateLife(int number)
|
|
||||||
{
|
|
||||||
auto life = m_World->CreateEntity();
|
|
||||||
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(life);
|
|
||||||
transform->Position = glm::vec3(-1.5f + number * 0.15f, -2.f, -5.f);
|
|
||||||
transform->Scale = glm::vec3(0.1f, 0.1f, 0.1f);
|
|
||||||
|
|
||||||
std::shared_ptr<Components::Life> lifeNr = m_World->AddComponent<Components::Life>(life);
|
|
||||||
lifeNr->Number = number;
|
|
||||||
|
|
||||||
auto model = m_World->AddComponent<Components::Model>(life);
|
|
||||||
model->ModelFile = "Models/Sid/Sid.dae";
|
|
||||||
|
|
||||||
|
|
||||||
m_World->CommitEntity(life);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool dd::Systems::BallSystem::OnLifeLost(const dd::Events::LifeLost &event)
|
|
||||||
{
|
|
||||||
if (!m_GodMode){
|
|
||||||
SetLives(Lives() - 1);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool dd::Systems::BallSystem::OnMultiBallLost(const dd::Events::MultiBallLost &event)
|
bool dd::Systems::BallSystem::OnMultiBallLost(const dd::Events::MultiBallLost &event)
|
||||||
{
|
{
|
||||||
SetMultiBalls(MultiBalls() - 1);
|
SetMultiBalls(MultiBalls() - 1);
|
||||||
@@ -531,11 +473,25 @@ bool dd::Systems::BallSystem::OnInkBlasterOver(const dd::Events::InkBlasterOver
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::BallSystem::OnKrakenAttack(const dd::Events::KrakenAttack &event)
|
||||||
|
{
|
||||||
|
m_KrakenAttack = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::BallSystem::OnKrakenAttackEnd(const dd::Events::KrakenAttackEnd &event)
|
||||||
|
{
|
||||||
|
m_KrakenAttack = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool dd::Systems::BallSystem::OnActionButton(const dd::Events::ActionButton &event)
|
bool dd::Systems::BallSystem::OnActionButton(const dd::Events::ActionButton &event)
|
||||||
{
|
{
|
||||||
if (!m_StageBlockedWaiting) {
|
if (!m_KrakenAttack) {
|
||||||
if (!m_InkBlockedWaiting) {
|
if (!m_StageBlockedWaiting) {
|
||||||
m_Waiting = false;
|
if (!m_InkBlockedWaiting) {
|
||||||
|
m_Waiting = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -82,19 +82,20 @@ void dd::Systems::KrakenSystem::UpdateEntity(double dt, EntityID entity, EntityI
|
|||||||
case 1: // Idle
|
case 1: // Idle
|
||||||
m_KrakenTimer += dt;
|
m_KrakenTimer += dt;
|
||||||
if (m_KrakenTimer > m_KrakenSecondsToAction) {
|
if (m_KrakenTimer > m_KrakenSecondsToAction) {
|
||||||
|
m_KrakenTimer = 0;
|
||||||
if (m_NumberOfActions == 0) {
|
if (m_NumberOfActions == 0) {
|
||||||
kraken->CurrentAction = 3;
|
kraken->CurrentAction = 3;
|
||||||
break;
|
} else {
|
||||||
|
std::uniform_real_distribution<float> dist(1, 4.999f);
|
||||||
|
float random = dist(m_RandomGenerator);
|
||||||
|
//std::cout << random << std::endl;
|
||||||
|
kraken->CurrentAction = random;
|
||||||
|
//std::cout << kraken->CurrentAction << std::endl;
|
||||||
}
|
}
|
||||||
m_KrakenTimer = 0;
|
|
||||||
std::uniform_real_distribution<float> dist(1, 4.999f);
|
|
||||||
float random = dist(m_RandomGenerator);
|
|
||||||
//std::cout << random << std::endl;
|
|
||||||
kraken->CurrentAction = random;
|
|
||||||
//std::cout << kraken->CurrentAction << std::endl;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // Grabbing
|
case 2: // Grabbing
|
||||||
|
m_NumberOfActions++;
|
||||||
kraken->CurrentAction = 5;
|
kraken->CurrentAction = 5;
|
||||||
krakenAttack.ChargeUpdate = 0;
|
krakenAttack.ChargeUpdate = 0;
|
||||||
krakenAttack.KrakenStrength = 0.1;
|
krakenAttack.KrakenStrength = 0.1;
|
||||||
@@ -103,6 +104,7 @@ void dd::Systems::KrakenSystem::UpdateEntity(double dt, EntityID entity, EntityI
|
|||||||
break;
|
break;
|
||||||
case 3: // Brick Generating
|
case 3: // Brick Generating
|
||||||
{
|
{
|
||||||
|
m_NumberOfActions++;
|
||||||
kraken->CurrentAction = 1;
|
kraken->CurrentAction = 1;
|
||||||
Events::BrickGenerating e;
|
Events::BrickGenerating e;
|
||||||
e.Origin1 = glm::vec3(-5, 7, -10);
|
e.Origin1 = glm::vec3(-5, 7, -10);
|
||||||
@@ -185,8 +187,29 @@ bool dd::Systems::KrakenSystem::OnContact(const dd::Events::Contact &event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto projectile = m_World->GetComponent<Components::Projectile>(otherEntitiy);
|
||||||
|
if (projectile != nullptr) {
|
||||||
|
Events::ScoreEvent es;
|
||||||
|
es.Score = 23;
|
||||||
|
Events::KrakenHit e;
|
||||||
|
e.Kraken = krakenEntity;
|
||||||
|
e.Hitter = otherEntitiy;
|
||||||
|
e.MaxHealth = kraken->MaxHealth;
|
||||||
|
e.CurrentHealth = kraken->Health;
|
||||||
|
e.NewHealth = kraken->Health - 1;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
m_World->RemoveEntity(otherEntitiy);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
auto ball = m_World->GetComponent<Components::Ball>(otherEntitiy);
|
auto ball = m_World->GetComponent<Components::Ball>(otherEntitiy);
|
||||||
if (ball != nullptr) {
|
if (ball != nullptr) {
|
||||||
|
ball->Combo += 1;
|
||||||
|
Events::ComboEvent ec;
|
||||||
|
ec.Combo = ball->Combo;
|
||||||
|
ec.Ball = otherEntitiy;
|
||||||
|
EventBroker->Publish(ec);
|
||||||
|
Events::ScoreEvent es;
|
||||||
|
es.Score = ball->Combo * 23;
|
||||||
Events::KrakenHit e;
|
Events::KrakenHit e;
|
||||||
e.Kraken = krakenEntity;
|
e.Kraken = krakenEntity;
|
||||||
e.Hitter = otherEntitiy;
|
e.Hitter = otherEntitiy;
|
||||||
@@ -195,6 +218,7 @@ bool dd::Systems::KrakenSystem::OnContact(const dd::Events::Contact &event)
|
|||||||
e.NewHealth = kraken->Health - 1;
|
e.NewHealth = kraken->Health - 1;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dd::Systems::KrakenSystem::OnKrakenAppear(const dd::Events::KrakenAppear &event)
|
bool dd::Systems::KrakenSystem::OnKrakenAppear(const dd::Events::KrakenAppear &event)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ void dd::Systems::LevelSystem::Initialize()
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EBrickGenerating, &LevelSystem::OnBrickGenerating);
|
EVENT_SUBSCRIBE_MEMBER(m_EBrickGenerating, &LevelSystem::OnBrickGenerating);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EKrakenDefeated, &LevelSystem::OnKrakenDefeated);
|
EVENT_SUBSCRIBE_MEMBER(m_EKrakenDefeated, &LevelSystem::OnKrakenDefeated);
|
||||||
|
|
||||||
m_GodMode = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue("Cheat.GodMode", false);
|
m_GodMode = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<bool>("Cheat.GodMode", false);
|
||||||
|
|
||||||
//PointLightTest
|
//PointLightTest
|
||||||
{
|
{
|
||||||
@@ -240,6 +240,7 @@ void dd::Systems::LevelSystem::Initialize()
|
|||||||
auto collisionSound = m_World->AddComponent<Components::CollisionSound>(m_BrickTemplate);
|
auto collisionSound = m_World->AddComponent<Components::CollisionSound>(m_BrickTemplate);
|
||||||
collisionSound->FilePath = "Sounds/Brick/shortbrickbreak.wav";
|
collisionSound->FilePath = "Sounds/Brick/shortbrickbreak.wav";
|
||||||
m_World->CommitEntity(m_BrickTemplate);
|
m_World->CommitEntity(m_BrickTemplate);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,6 +311,7 @@ void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
}
|
}
|
||||||
m_LooseBricks--;
|
m_LooseBricks--;
|
||||||
m_World->RemoveEntity(entity);
|
m_World->RemoveEntity(entity);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,6 +441,7 @@ EntityID dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spac
|
|||||||
} else if (typeInt == InkBlasterBrick) {
|
} else if (typeInt == InkBlasterBrick) {
|
||||||
cBrick->Type = InkBlasterBrick;
|
cBrick->Type = InkBlasterBrick;
|
||||||
auto type = m_World->AddComponent<Components::InkBlasterBrick>(brick);
|
auto type = m_World->AddComponent<Components::InkBlasterBrick>(brick);
|
||||||
|
//model->ModelFile = "Models/Brick/InkBrick.obj";
|
||||||
model->Color = glm::vec4(0.1f, 0.1f, 0.1f, 1.0f);
|
model->Color = glm::vec4(0.1f, 0.1f, 0.1f, 1.0f);
|
||||||
} else if (typeInt == KrakenAttackBrick) {
|
} else if (typeInt == KrakenAttackBrick) {
|
||||||
cBrick->Type = KrakenAttackBrick;
|
cBrick->Type = KrakenAttackBrick;
|
||||||
@@ -908,6 +911,7 @@ bool dd::Systems::LevelSystem::OnPowerUpTaken(const dd::Events::PowerUpTaken &ev
|
|||||||
|
|
||||||
bool dd::Systems::LevelSystem::OnKrakenDefeated(const dd::Events::KrakenDefeated &event)
|
bool dd::Systems::LevelSystem::OnKrakenDefeated(const dd::Events::KrakenDefeated &event)
|
||||||
{
|
{
|
||||||
|
m_BrickGenerating = false;
|
||||||
SetNumberOfBricks(NumberOfBricks() - 1);
|
SetNumberOfBricks(NumberOfBricks() - 1);
|
||||||
m_LooseBricks--;
|
m_LooseBricks--;
|
||||||
|
|
||||||
@@ -1097,7 +1101,7 @@ void dd::Systems::LevelSystem::GetNextLevel()
|
|||||||
1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 0, 1, 2, 1, 0, 1,
|
1, 0, 1, 2, 1, 0, 1,
|
||||||
0, 1, 0, 1, 0, 1, 0,
|
0, 1, 0, 1, 0, 1, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 6,
|
||||||
0, 0, 0, 0, 0, 0, 0};
|
0, 0, 0, 0, 0, 0, 0};
|
||||||
color =
|
color =
|
||||||
{w, w, w, w, w, w, w,
|
{w, w, w, w, w, w, w,
|
||||||
@@ -1206,39 +1210,45 @@ void dd::Systems::LevelSystem::SetBrokenModel(EntityID entity)
|
|||||||
std::uniform_int_distribution<int> dist(0, 2);
|
std::uniform_int_distribution<int> dist(0, 2);
|
||||||
int index = dist(m_RandomGenerator);
|
int index = dist(m_RandomGenerator);
|
||||||
|
|
||||||
|
int parts = 0;
|
||||||
|
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/1/WhiteBrickBreak1.obj", glm::vec3(-0.29912f, 0.0082f, 0.f), glm::vec2(0.281f, 0.351f));
|
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/1/WhiteBrickBreak1.obj", glm::vec3(-0.29912f, 0.0082f, 0.f), glm::vec2(0.281f, 0.351f), 3);
|
||||||
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/1/WhiteBrickBreak2.obj", glm::vec3(0.07597f, -0.02899f, 0.f), glm::vec2(0.559f, 0.351f));
|
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/1/WhiteBrickBreak2.obj", glm::vec3(0.07597f, -0.02899f, 0.f), glm::vec2(0.559f, 0.351f), 3);
|
||||||
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/1/WhiteBrickBreak3.obj", glm::vec3(0.3227f, 0.05632, 0.f), glm::vec2(0.25f, 0.25f));
|
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/1/WhiteBrickBreak3.obj", glm::vec3(0.3227f, 0.05632, 0.f), glm::vec2(0.25f, 0.25f), 3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/2/WhiteBrickBreak1.obj", glm::vec3(-0.3236f, 0.0159f, 0.f), glm::vec2(0.237f, 0.327f));
|
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/2/WhiteBrickBreak1.obj", glm::vec3(-0.3236f, 0.0159f, 0.f), glm::vec2(0.237f, 0.327f), 4);
|
||||||
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/2/WhiteBrickBreak2.obj", glm::vec3(0.07645f, 0.03131f, 0.f), glm::vec2(0.594f, 0.211f));
|
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/2/WhiteBrickBreak2.obj", glm::vec3(0.07645f, 0.03131f, 0.f), glm::vec2(0.594f, 0.211f), 4);
|
||||||
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/2/WhiteBrickBreak3.obj", glm::vec3(0.09468f, -0.11792f, 0.f), glm::vec2(0.692f, 0.112f));
|
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/2/WhiteBrickBreak3.obj", glm::vec3(0.09468f, -0.11792f, 0.f), glm::vec2(0.692f, 0.112f), 4);
|
||||||
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/2/WhiteBrickBreak4.obj", glm::vec3(0.33957f, 0.13079f, 0.f), glm::vec2(0.208f, 0.085f));
|
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/2/WhiteBrickBreak4.obj", glm::vec3(0.33957f, 0.13079f, 0.f), glm::vec2(0.208f, 0.085f), 4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/3/WhiteBrickBreak1.obj", glm::vec3(-0.34882f, 0.0564f, 0.f), glm::vec2(0.175f, 0.228f));
|
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/3/WhiteBrickBreak1.obj", glm::vec3(-0.34882f, 0.0564f, 0.f), glm::vec2(0.175f, 0.228f), 4);
|
||||||
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/3/WhiteBrickBreak2.obj", glm::vec3(0.0678f, 0.07679f, 0.f), glm::vec2(0.699f, 0.183f));
|
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/3/WhiteBrickBreak2.obj", glm::vec3(0.0678f, 0.07679f, 0.f), glm::vec2(0.699f, 0.183f), 4);
|
||||||
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/3/WhiteBrickBreak3.obj", glm::vec3(-0.11862f, -0.10342, 0.f), glm::vec2(0.563f, 0.164f));
|
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/3/WhiteBrickBreak3.obj", glm::vec3(-0.11862f, -0.10342, 0.f), glm::vec2(0.563f, 0.164f), 4);
|
||||||
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/3/WhiteBrickBreak4.obj", glm::vec3(0.31479f, -0.06351f, 0.f), glm::vec2(0.261f, 0.21f));
|
CreateBrokenModelPart(entity, "Models/Brick/BrickBreak/3/WhiteBrickBreak4.obj", glm::vec3(0.31479f, -0.06351f, 0.f), glm::vec2(0.261f, 0.21f), 4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG_INFO("Something went wrong with the random generator in SetBrokenModel");
|
LOG_INFO("Something went wrong with the random generator in SetBrokenModel");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dd::Systems::LevelSystem::CreateBrokenModelPart(EntityID Parent, std::string ModelPath, glm::vec3 RelativePosition, glm::vec2 Hitbox)
|
void dd::Systems::LevelSystem::CreateBrokenModelPart(EntityID Parent, std::string ModelPath, glm::vec3 RelativePosition, glm::vec2 Hitbox, int NumberOfParts)
|
||||||
{
|
{
|
||||||
auto ent = m_World->CreateEntity(Parent);
|
auto ent = m_World->CreateEntity(Parent);
|
||||||
auto cTemplate = m_World->AddComponent<Components::Template>(ent);
|
auto cTemplate = m_World->AddComponent<Components::Template>(ent);
|
||||||
auto cTransform = m_World->AddComponent<Components::Transform>(ent);
|
auto cTransform = m_World->AddComponent<Components::Transform>(ent);
|
||||||
|
auto cBrickPart = m_World->AddComponent<Components::BrickPart>(ent);
|
||||||
|
cBrickPart->NumberOfPartsInBrick = NumberOfParts;
|
||||||
|
|
||||||
cTransform->Position = RelativePosition;
|
cTransform->Position = RelativePosition;
|
||||||
|
|
||||||
@@ -1251,6 +1261,7 @@ void dd::Systems::LevelSystem::CreateBrokenModelPart(EntityID Parent, std::strin
|
|||||||
auto cPhys = m_World->AddComponent<Components::Physics>(ent);
|
auto cPhys = m_World->AddComponent<Components::Physics>(ent);
|
||||||
cPhys->CollisionType = CollisionType::Type::Dynamic;
|
cPhys->CollisionType = CollisionType::Type::Dynamic;
|
||||||
cPhys->GravityScale = 1.f;
|
cPhys->GravityScale = 1.f;
|
||||||
|
cPhys->Density = 30;
|
||||||
cPhys->Category = CollisionLayer::Type::Brick;
|
cPhys->Category = CollisionLayer::Type::Brick;
|
||||||
cPhys->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Type::Wall);
|
cPhys->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Type::Wall);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,102 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-13.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "PrecompiledHeader.h"
|
||||||
|
#include "Game/LifeSystem.h"
|
||||||
|
|
||||||
|
void dd::Systems::LifeSystem::Initialize()
|
||||||
|
{
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EPause, &LifeSystem::OnPause);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EResume, &LifeSystem::OnResume);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_ELifeLost, &LifeSystem::OnLifeLost);
|
||||||
|
|
||||||
|
for (int i = 0; i < Lives(); i++) {
|
||||||
|
CreateLife(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_GodMode = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<bool>("Cheat.GodMode", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dd::Systems::LifeSystem::Update(double dt)
|
||||||
|
{
|
||||||
|
if (m_Pause) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Lives() < 0) {
|
||||||
|
Events::KrakenAttackEnd ek;
|
||||||
|
EventBroker->Publish(ek);
|
||||||
|
|
||||||
|
Events::GameOver e;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
|
||||||
|
Events::Pause p;
|
||||||
|
p.Type = "All";
|
||||||
|
EventBroker->Publish(p);
|
||||||
|
|
||||||
|
//TODO: Make this not so ugly
|
||||||
|
SetLives(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dd::Systems::LifeSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||||
|
{
|
||||||
|
if (m_Pause) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
||||||
|
if (templateCheck != nullptr){ return; }
|
||||||
|
|
||||||
|
if (Lives() != PastLives()) {
|
||||||
|
auto life = m_World->GetComponent<Components::Life>(entity);
|
||||||
|
if (life != nullptr) {
|
||||||
|
if (life->Number + 1 == PastLives()) {
|
||||||
|
m_World->RemoveEntity(entity);
|
||||||
|
SetPastLives(Lives());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dd::Systems::LifeSystem::CreateLife(int number)
|
||||||
|
{
|
||||||
|
auto life = m_World->CreateEntity();
|
||||||
|
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(life);
|
||||||
|
transform->Position = glm::vec3(-1.5f + number * 0.15f, -2.f, -5.f);
|
||||||
|
transform->Scale = glm::vec3(0.1f, 0.1f, 0.1f);
|
||||||
|
|
||||||
|
std::shared_ptr<Components::Life> lifeNr = m_World->AddComponent<Components::Life>(life);
|
||||||
|
lifeNr->Number = number;
|
||||||
|
|
||||||
|
auto model = m_World->AddComponent<Components::Model>(life);
|
||||||
|
model->ModelFile = "Models/Sid/Sid.dae";
|
||||||
|
|
||||||
|
m_World->CommitEntity(life);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::LifeSystem::OnLifeLost(const dd::Events::LifeLost &event)
|
||||||
|
{
|
||||||
|
if (!m_GodMode){
|
||||||
|
SetLives(Lives() - 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::LifeSystem::OnPause(const dd::Events::Pause &event)
|
||||||
|
{
|
||||||
|
/*if (event.Type != "LifeSystem" && event.Type != "All") {
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
m_Pause = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool dd::Systems::LifeSystem::OnResume(const dd::Events::Resume &event)
|
||||||
|
{
|
||||||
|
/*if (event.Type != "LifeSystem" && event.Type != "All") {
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
m_Pause = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
+50
-17
@@ -34,6 +34,7 @@ void dd::Systems::PadSystem::Initialize()
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &PadSystem::OnPause);
|
EVENT_SUBSCRIBE_MEMBER(m_EPause, &PadSystem::OnPause);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &PadSystem::OnResume);
|
EVENT_SUBSCRIBE_MEMBER(m_EResume, &PadSystem::OnResume);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &PadSystem::OnKrakenAttack);
|
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &PadSystem::OnKrakenAttack);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttackEnd, &PadSystem::OnKrakenAttackEnd);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EStickyPad, &PadSystem::OnStickyPad);
|
EVENT_SUBSCRIBE_MEMBER(m_EStickyPad, &PadSystem::OnStickyPad);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EStickyAttachedToPad, &PadSystem::OnStickyAttachedToPad);
|
EVENT_SUBSCRIBE_MEMBER(m_EStickyAttachedToPad, &PadSystem::OnStickyAttachedToPad);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &PadSystem::OnActionButton);
|
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &PadSystem::OnActionButton);
|
||||||
@@ -43,7 +44,7 @@ void dd::Systems::PadSystem::Initialize()
|
|||||||
auto ent = m_World->CreateEntity();
|
auto ent = m_World->CreateEntity();
|
||||||
m_World->SetProperty(ent, "Name", "Pad");
|
m_World->SetProperty(ent, "Name", "Pad");
|
||||||
auto ctransform = m_World->AddComponent<Components::Transform>(ent);
|
auto ctransform = m_World->AddComponent<Components::Transform>(ent);
|
||||||
ctransform->Position = glm::vec3(0.f, -4.8f, -10.f);
|
ctransform->Position = glm::vec3(0.f, m_PadHeight, -10.f);
|
||||||
auto rectangleShape = m_World->AddComponent<Components::RectangleShape>(ent);
|
auto rectangleShape = m_World->AddComponent<Components::RectangleShape>(ent);
|
||||||
rectangleShape->Dimensions = glm::vec2(1.f, 0.1f);
|
rectangleShape->Dimensions = glm::vec2(1.f, 0.1f);
|
||||||
auto physics = m_World->AddComponent<Components::Physics>(ent);
|
auto physics = m_World->AddComponent<Components::Physics>(ent);
|
||||||
@@ -158,6 +159,13 @@ void dd::Systems::PadSystem::Update(double dt)
|
|||||||
auto pad = Pad();
|
auto pad = Pad();
|
||||||
auto acceleration = Acceleration();
|
auto acceleration = Acceleration();
|
||||||
|
|
||||||
|
if (glm::abs(transform->Position.y - m_PadHeight) > m_PadRiseSpeed) {
|
||||||
|
if (transform->Position.y < m_PadHeight) {
|
||||||
|
transform->Position.y += m_PadRiseSpeed * (float)dt;
|
||||||
|
} else if (transform->Position.y > m_PadHeight) {
|
||||||
|
transform->Position.y -= m_PadRiseSpeed * 5 * (float)dt;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (transform->Velocity.x < -pad->MaxSpeed) {
|
if (transform->Velocity.x < -pad->MaxSpeed) {
|
||||||
transform->Velocity.x = -pad->MaxSpeed;
|
transform->Velocity.x = -pad->MaxSpeed;
|
||||||
}
|
}
|
||||||
@@ -419,6 +427,7 @@ bool dd::Systems::PadSystem::OnStageCleared(const dd::Events::StageCleared &even
|
|||||||
{
|
{
|
||||||
//auto entity = CreateBall();
|
//auto entity = CreateBall();
|
||||||
m_StickyAim->Aiming = false;
|
m_StickyAim->Aiming = false;
|
||||||
|
m_PadHeight = m_PadOriginalHeight;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,14 +459,8 @@ bool dd::Systems::PadSystem::OnRaiseWaterWall(const dd::Events::RaiseWaterWall &
|
|||||||
|
|
||||||
bool dd::Systems::PadSystem::RaisePad(float amount, float speed)
|
bool dd::Systems::PadSystem::RaisePad(float amount, float speed)
|
||||||
{
|
{
|
||||||
auto transform = Transform();
|
m_PadHeight += amount;
|
||||||
glm::vec3 raise = glm::vec3(0, amount, 0);
|
m_PadRiseSpeed = speed;
|
||||||
Events::Move e;
|
|
||||||
e.Entity = m_Entity;
|
|
||||||
e.GoalPosition = transform->Position + raise;
|
|
||||||
e.Speed = speed;
|
|
||||||
e.Queue = true;
|
|
||||||
EventBroker->Publish(e);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,30 +476,60 @@ bool dd::Systems::PadSystem::OnKrakenAttack(const dd::Events::KrakenAttack &even
|
|||||||
|
|
||||||
transform->Velocity = glm::vec3(0, 0, 0);
|
transform->Velocity = glm::vec3(0, 0, 0);
|
||||||
acceleration = glm::vec3(0, 0, 0);
|
acceleration = glm::vec3(0, 0, 0);
|
||||||
|
LOG_INFO("Kraken arm duuude");
|
||||||
if (!m_KrakenArm){
|
if (!m_KrakenArm){
|
||||||
|
LOG_INFO("InKrakenArmDuuude");
|
||||||
m_KrakenArm = m_World->CreateEntity(Entity());
|
m_KrakenArm = m_World->CreateEntity(Entity());
|
||||||
auto transform = m_World->AddComponent<Components::Transform>(m_KrakenArm);
|
auto transform = m_World->AddComponent<Components::Transform>(m_KrakenArm);
|
||||||
transform->Position = glm::vec3(1.f, -3.0f, 0.f);
|
transform->Position = glm::vec3(1.f, -3.0f, 0.f);
|
||||||
auto model = m_World->AddComponent<Components::Model>(m_KrakenArm);
|
auto model = m_World->AddComponent<Components::Model>(m_KrakenArm);
|
||||||
model->ModelFile = "Models/kraken/Arm.dae";
|
model->ModelFile = "Models/Kraken/Arm.dae";
|
||||||
auto animation = m_World->AddComponent<Components::Animation>(m_KrakenArm);
|
auto animation = m_World->AddComponent<Components::Animation>(m_KrakenArm);
|
||||||
animation->Speed = 1.0f;
|
animation->Speed = 1.0f;
|
||||||
|
animation->Loop = false;
|
||||||
m_World->CommitEntity(m_KrakenArm);
|
m_World->CommitEntity(m_KrakenArm);
|
||||||
|
|
||||||
|
m_KrakenArmHitbox = m_World->CreateEntity();
|
||||||
|
auto hb_transform = m_World->AddComponent<Components::Transform>(m_KrakenArmHitbox);
|
||||||
|
hb_transform->Position = transform->Position + glm::vec3(-1.f, -5.0f, -10.f);
|
||||||
|
//hb_transform->Position = glm::vec3(-2.f, -8.0f, -10.f);
|
||||||
|
hb_transform->Scale = glm::vec3(2.5f, 2.5f, 1.f);
|
||||||
|
hb_transform->Velocity = glm::vec3(0.f, 10.f, 0.f);
|
||||||
|
//auto hb_sprite = m_World->AddComponent<Components::Sprite>(m_KrakenArmHitbox);
|
||||||
|
//hb_sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
|
||||||
|
auto hb_physics = m_World->AddComponent<Components::Physics>(m_KrakenArmHitbox);
|
||||||
|
hb_physics->Calculate = true;
|
||||||
|
hb_physics->CollisionType = CollisionType::Type::Static;
|
||||||
|
hb_physics->Category = CollisionLayer::Type::Other;
|
||||||
|
hb_physics->Mask = CollisionLayer::Type::Water;
|
||||||
|
hb_physics->GravityScale = 0.f;
|
||||||
|
auto hb_HitBox = m_World->AddComponent<Components::CircleShape>(m_KrakenArmHitbox);
|
||||||
|
hb_HitBox->Radius = 1.25f;
|
||||||
|
m_World->CommitEntity(m_KrakenArmHitbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetTransform(transform);
|
SetTransform(transform);
|
||||||
SetAcceleration(acceleration);
|
SetAcceleration(acceleration);
|
||||||
} else if (m_KrakenCharge >= 1) {
|
} else if (m_KrakenCharge >= 1) {
|
||||||
m_KrakenAttack = false;
|
m_KrakenAttack = false;
|
||||||
m_KrakenCharge = 0;
|
Events::KrakenAttackEnd e;
|
||||||
m_KrakenStrength = 0;
|
EventBroker->Publish(e);
|
||||||
m_PlayerStrength = 0;
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::PadSystem::OnKrakenAttackEnd(const dd::Events::KrakenAttackEnd &event)
|
||||||
|
{
|
||||||
|
m_KrakenAttack = false;
|
||||||
|
m_KrakenCharge = 0;
|
||||||
|
m_KrakenStrength = 0;
|
||||||
|
m_PlayerStrength = 0;
|
||||||
|
|
||||||
m_World->RemoveEntity(m_KrakenArm);
|
m_World->RemoveEntity(m_KrakenArm);
|
||||||
|
m_World->RemoveEntity(m_KrakenArmHitbox);
|
||||||
m_KrakenArm = NULL;
|
m_KrakenArm = NULL;
|
||||||
|
m_KrakenArmHitbox = NULL;
|
||||||
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ void dd::Systems::ProjectileSystem::Initialize()
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &ProjectileSystem::OnPause);
|
EVENT_SUBSCRIBE_MEMBER(m_EPause, &ProjectileSystem::OnPause);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &ProjectileSystem::OnResume);
|
EVENT_SUBSCRIBE_MEMBER(m_EResume, &ProjectileSystem::OnResume);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EInkBlaster, &ProjectileSystem::OnInkBlaster);
|
EVENT_SUBSCRIBE_MEMBER(m_EInkBlaster, &ProjectileSystem::OnInkBlaster);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &ProjectileSystem::OnKrakenAttack);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttackEnd, &ProjectileSystem::OnKrakenAttackEnd);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EHitPad, &ProjectileSystem::OnHitPad);
|
EVENT_SUBSCRIBE_MEMBER(m_EHitPad, &ProjectileSystem::OnHitPad);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &ProjectileSystem::OnActionButton);
|
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &ProjectileSystem::OnActionButton);
|
||||||
|
|
||||||
@@ -113,34 +115,48 @@ bool dd::Systems::ProjectileSystem::OnHitPad(const dd::Events::HitPad &event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::ProjectileSystem::OnKrakenAttack(const dd::Events::KrakenAttack &event)
|
||||||
|
{
|
||||||
|
m_KrakenAttack = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::ProjectileSystem::OnKrakenAttackEnd(const dd::Events::KrakenAttackEnd &event)
|
||||||
|
{
|
||||||
|
m_KrakenAttack = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool dd::Systems::ProjectileSystem::OnActionButton(const dd::Events::ActionButton &event)
|
bool dd::Systems::ProjectileSystem::OnActionButton(const dd::Events::ActionButton &event)
|
||||||
{
|
{
|
||||||
if (m_InkBlaster && m_SquidLoaded) {
|
if (!m_KrakenAttack) {
|
||||||
auto ent = m_World->CloneEntity(m_InkBlastTemplate);
|
if (m_InkBlaster && m_SquidLoaded) {
|
||||||
m_World->RemoveComponent<Components::Template>(ent);
|
auto ent = m_World->CloneEntity(m_InkBlastTemplate);
|
||||||
auto projectile = m_World->GetComponent<Components::Projectile>(ent);
|
m_World->RemoveComponent<Components::Template>(ent);
|
||||||
projectile->Speed = m_InkBlasterSpeed;
|
auto projectile = m_World->GetComponent<Components::Projectile>(ent);
|
||||||
auto transform = m_World->GetComponent<Components::Transform>(ent);
|
projectile->Speed = m_InkBlasterSpeed;
|
||||||
transform->Position = event.Position;
|
auto transform = m_World->GetComponent<Components::Transform>(ent);
|
||||||
transform->Velocity = glm::vec3(0, projectile->Speed, 0);
|
transform->Position = event.Position;
|
||||||
m_Shots--;
|
transform->Velocity = glm::vec3(0, projectile->Speed, 0);
|
||||||
if (m_Shots <= 0) {
|
m_Shots--;
|
||||||
auto ball = m_World->GetComponent<Components::Ball>(m_AttachedSquid);
|
if (m_Shots <= 0) {
|
||||||
m_InkBlaster = false;
|
auto ball = m_World->GetComponent<Components::Ball>(m_AttachedSquid);
|
||||||
m_SquidLoaded = false;
|
m_InkBlaster = false;
|
||||||
ball->InkBlaster = false;
|
m_SquidLoaded = false;
|
||||||
ball->Sticky = false;
|
ball->InkBlaster = false;
|
||||||
ball->Waiting = true;
|
ball->Sticky = false;
|
||||||
|
ball->Waiting = true;
|
||||||
|
|
||||||
{
|
{
|
||||||
Events::InkBlasterOver e;
|
Events::InkBlasterOver e;
|
||||||
e.Ball = m_AttachedSquid;
|
e.Ball = m_AttachedSquid;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Events::ActionButton e;
|
Events::ActionButton e;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ void dd::Systems::WaterSystem::Initialize()
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_ERaiseWater, &WaterSystem::OnRaiseWater);
|
EVENT_SUBSCRIBE_MEMBER(m_ERaiseWater, &WaterSystem::OnRaiseWater);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ERaiseWaterWall, &WaterSystem::OnRaiseWaterWall);
|
EVENT_SUBSCRIBE_MEMBER(m_ERaiseWaterWall, &WaterSystem::OnRaiseWaterWall);
|
||||||
|
|
||||||
|
m_RaiseWater = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<bool>("Debug.RaiseWater", false);
|
||||||
|
|
||||||
//Water test
|
//Water test
|
||||||
{
|
{
|
||||||
auto t_waterBody = m_World->CreateEntity();
|
auto t_waterBody = m_World->CreateEntity();
|
||||||
@@ -24,6 +26,10 @@ void dd::Systems::WaterSystem::Initialize()
|
|||||||
auto body = m_World->AddComponent<Components::RectangleShape>(t_waterBody);
|
auto body = m_World->AddComponent<Components::RectangleShape>(t_waterBody);
|
||||||
m_World->CommitEntity(t_waterBody);
|
m_World->CommitEntity(t_waterBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_BrickPartCounters =
|
||||||
|
{0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void dd::Systems::WaterSystem::Update(double dt)
|
void dd::Systems::WaterSystem::Update(double dt)
|
||||||
@@ -43,6 +49,31 @@ void dd::Systems::WaterSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
||||||
if (templateCheck != nullptr){ return; }
|
if (templateCheck != nullptr){ return; }
|
||||||
|
|
||||||
|
auto brickPart = m_World->GetComponent<Components::BrickPart>(entity);
|
||||||
|
if (brickPart != nullptr) {
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
|
if (m_RaiseWater) {
|
||||||
|
if (!brickPart->Submerged) {
|
||||||
|
if (transform->Position.y < m_SubmergedHeight) {
|
||||||
|
brickPart->Submerged = true;
|
||||||
|
m_BrickPartCounters[brickPart->NumberOfPartsInBrick]++;
|
||||||
|
std::cout << "Parts: " << m_BrickPartCounters[brickPart->NumberOfPartsInBrick] << " of " << brickPart->NumberOfPartsInBrick << std::endl;
|
||||||
|
if (m_BrickPartCounters[brickPart->NumberOfPartsInBrick] >= brickPart->NumberOfPartsInBrick) {
|
||||||
|
m_BrickPartCounters[brickPart->NumberOfPartsInBrick] = 0;
|
||||||
|
Events::RaiseWater e;
|
||||||
|
e.Amount = 0.2;
|
||||||
|
e.Speed = 0.2;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (transform->Position.y < -10) {
|
||||||
|
m_World->RemoveEntity(entity);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_BottomWall == 0) {
|
if (m_BottomWall == 0) {
|
||||||
for (auto it = m_World->GetEntities()->begin(); it != m_World->GetEntities()->end(); it++) {
|
for (auto it = m_World->GetEntities()->begin(); it != m_World->GetEntities()->end(); it++) {
|
||||||
if (m_World->GetProperty<std::string>(it->first, "Name") == "BottomWall") {
|
if (m_World->GetProperty<std::string>(it->first, "Name") == "BottomWall") {
|
||||||
@@ -51,6 +82,21 @@ void dd::Systems::WaterSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto newWater = m_World->GetComponent<Components::NewWaterVolume>(entity);
|
||||||
|
if (newWater != nullptr) {
|
||||||
|
if (m_RemoveWater) {
|
||||||
|
//m_World->RemoveComponent<Components::WaterVolume>(entity);
|
||||||
|
//m_World->RemoveComponent<Components::RectangleShape>(entity);
|
||||||
|
//m_World->RemoveComponent<Components::WaterVolume>(entity);
|
||||||
|
//m_World->RemoveEntity(entity);
|
||||||
|
//m_World->RemoveComponent<Components::>();
|
||||||
|
}
|
||||||
|
/*auto transform = m_World->AddComponent<Components::Transform>(entity);
|
||||||
|
if (transform->Position.y < -10) {
|
||||||
|
m_World->RemoveEntity(entity);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dd::Systems::WaterSystem::OnPause(const dd::Events::Pause &event)
|
bool dd::Systems::WaterSystem::OnPause(const dd::Events::Pause &event)
|
||||||
@@ -80,13 +126,14 @@ bool dd::Systems::WaterSystem::OnRelevantObjectCreated(const dd::Events::Relevan
|
|||||||
|
|
||||||
bool dd::Systems::WaterSystem::OnStageCleared(const dd::Events::StageCleared &event)
|
bool dd::Systems::WaterSystem::OnStageCleared(const dd::Events::StageCleared &event)
|
||||||
{
|
{
|
||||||
|
m_SubmergedHeight = m_SubmergedOriginalHeight;
|
||||||
|
m_RemoveWater = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dd::Systems::WaterSystem::OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event)
|
bool dd::Systems::WaterSystem::OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event)
|
||||||
{
|
{
|
||||||
|
m_RemoveWater = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,13 +142,16 @@ bool dd::Systems::WaterSystem::OnRaiseWater(const dd::Events::RaiseWater &event)
|
|||||||
{
|
{
|
||||||
auto t_waterBody = m_World->CreateEntity();
|
auto t_waterBody = m_World->CreateEntity();
|
||||||
auto transform = m_World->AddComponent<Components::Transform>(t_waterBody);
|
auto transform = m_World->AddComponent<Components::Transform>(t_waterBody);
|
||||||
transform->Position = glm::vec3(0.f, -3.5f, -10.f);
|
transform->Position = glm::vec3(0.f, m_SubmergedHeight, -10.f);
|
||||||
transform->Scale = glm::vec3(7.0f, event.Amount * 1.6f, 1.f);
|
transform->Scale = glm::vec3(7.0f, event.Amount * 1.4f, 1.f);
|
||||||
auto water = m_World->AddComponent<Components::WaterVolume>(t_waterBody);
|
auto water = m_World->AddComponent<Components::WaterVolume>(t_waterBody);
|
||||||
|
auto newWater = m_World->AddComponent<Components::NewWaterVolume>(t_waterBody); //Meaning it isn't the original water we had.
|
||||||
auto body = m_World->AddComponent<Components::RectangleShape>(t_waterBody);
|
auto body = m_World->AddComponent<Components::RectangleShape>(t_waterBody);
|
||||||
m_World->CommitEntity(t_waterBody);
|
m_World->CommitEntity(t_waterBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_SubmergedHeight += event.Amount;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ void dd::Systems::PhysicsSystem::InitializeWater()
|
|||||||
m_ParticleSystemDef.radius = radius;
|
m_ParticleSystemDef.radius = radius;
|
||||||
m_ParticleSystemDef.gravityScale = gravityScale;
|
m_ParticleSystemDef.gravityScale = gravityScale;
|
||||||
m_ParticleSystemDef.density = 4.f;
|
m_ParticleSystemDef.density = 4.f;
|
||||||
|
m_ParticleSystemDef.surfaceTensionNormalStrength = 0.07;
|
||||||
|
|
||||||
m_WaterParticleSystem = m_PhysicsWorld->CreateParticleSystem(&m_ParticleSystemDef);
|
m_WaterParticleSystem = m_PhysicsWorld->CreateParticleSystem(&m_ParticleSystemDef);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user