Merge branch 'master' into directx
Conflicts: include/Core/Engine.h
This commit is contained in:
@@ -9,4 +9,4 @@ BGMVolume=0.5
|
|||||||
[Video]
|
[Video]
|
||||||
Fullscreen=false
|
Fullscreen=false
|
||||||
Width=675
|
Width=675
|
||||||
Height=1080
|
Height=1080[Water]Radius=0.3[Cheat]GodMode=false
|
||||||
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 7.4 KiB |
Executable
BIN
Binary file not shown.
@@ -41,9 +41,6 @@ struct Transform : public Component
|
|||||||
glm::vec3 Velocity;
|
glm::vec3 Velocity;
|
||||||
/** Physical scale multiplier. */
|
/** Physical scale multiplier. */
|
||||||
glm::vec3 Scale;
|
glm::vec3 Scale;
|
||||||
|
|
||||||
// Sticky is if it sticks with the player or not. True means it will follow the camera.
|
|
||||||
bool Sticky = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+29
-261
@@ -48,12 +48,18 @@
|
|||||||
#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/CWall.h"
|
||||||
|
#include "Game/CKraken.h"
|
||||||
|
#include "Game/CBackground.h"
|
||||||
|
#include "Game/CTravels.h"
|
||||||
#include "Game/CStickyAim.h"
|
#include "Game/CStickyAim.h"
|
||||||
#include "Game/BallSystem.h"
|
#include "Game/BallSystem.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"
|
||||||
#include "Game/ProjectileSystem.h"
|
#include "Game/ProjectileSystem.h"
|
||||||
|
#include "Game/KrakenSystem.h"
|
||||||
|
#include "Game/WaterSystem.h"
|
||||||
#include "Game/Bricks/CPowerUpBrick.h"
|
#include "Game/Bricks/CPowerUpBrick.h"
|
||||||
|
|
||||||
#include "Game/BrickComponents.h"
|
#include "Game/BrickComponents.h"
|
||||||
@@ -139,10 +145,14 @@ public:
|
|||||||
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::Pad>();
|
m_World->ComponentFactory.Register<Components::Pad>();
|
||||||
|
m_World->ComponentFactory.Register<Components::Wall>();
|
||||||
|
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>();
|
||||||
m_World->ComponentFactory.Register<Components::Projectile>();
|
m_World->ComponentFactory.Register<Components::Projectile>();
|
||||||
|
m_World->ComponentFactory.Register<Components::Kraken>();
|
||||||
m_World->ComponentFactory.Register<Components::StickyAim>();
|
m_World->ComponentFactory.Register<Components::StickyAim>();
|
||||||
|
m_World->ComponentFactory.Register<Components::Travels>();
|
||||||
|
|
||||||
m_World->ComponentFactory.Register<Components::PowerUp>();
|
m_World->ComponentFactory.Register<Components::PowerUp>();
|
||||||
m_World->ComponentFactory.Register<Components::PowerUpBrick>();
|
m_World->ComponentFactory.Register<Components::PowerUpBrick>();
|
||||||
@@ -155,7 +165,7 @@ public:
|
|||||||
m_World->ComponentFactory.Register<Components::KrakenAttackBrick>();
|
m_World->ComponentFactory.Register<Components::KrakenAttackBrick>();
|
||||||
|
|
||||||
m_World->SystemFactory.Register<Systems::LevelSystem>(
|
m_World->SystemFactory.Register<Systems::LevelSystem>(
|
||||||
[this]() { return new Systems::LevelSystem(m_World.get(), m_EventBroker); });
|
[this]() { return new Systems::LevelSystem(m_World.get(), m_EventBroker); });
|
||||||
m_World->AddSystem<Systems::LevelSystem>();
|
m_World->AddSystem<Systems::LevelSystem>();
|
||||||
m_World->SystemFactory.Register<Systems::PadSystem>(
|
m_World->SystemFactory.Register<Systems::PadSystem>(
|
||||||
[this]() { return new Systems::PadSystem(m_World.get(), m_EventBroker); });
|
[this]() { return new Systems::PadSystem(m_World.get(), m_EventBroker); });
|
||||||
@@ -181,6 +191,12 @@ public:
|
|||||||
m_World->SystemFactory.Register<Systems::TravellingSystem>(
|
m_World->SystemFactory.Register<Systems::TravellingSystem>(
|
||||||
[this]() { return new Systems::TravellingSystem(m_World.get(), m_EventBroker); });
|
[this]() { return new Systems::TravellingSystem(m_World.get(), m_EventBroker); });
|
||||||
m_World->AddSystem<Systems::TravellingSystem>();
|
m_World->AddSystem<Systems::TravellingSystem>();
|
||||||
|
m_World->SystemFactory.Register<Systems::KrakenSystem>(
|
||||||
|
[this]() { return new Systems::KrakenSystem(m_World.get(), m_EventBroker); });
|
||||||
|
m_World->AddSystem<Systems::KrakenSystem>();
|
||||||
|
m_World->SystemFactory.Register<Systems::WaterSystem>(
|
||||||
|
[this]() { return new Systems::WaterSystem(m_World.get(), m_EventBroker); });
|
||||||
|
m_World->AddSystem<Systems::WaterSystem>();
|
||||||
|
|
||||||
m_World->ComponentFactory.Register<Components::Model>();
|
m_World->ComponentFactory.Register<Components::Model>();
|
||||||
m_World->ComponentFactory.Register<Components::Template>();
|
m_World->ComponentFactory.Register<Components::Template>();
|
||||||
@@ -190,206 +206,10 @@ public:
|
|||||||
m_World->ComponentFactory.Register<Components::ParticleEmitter>();
|
m_World->ComponentFactory.Register<Components::ParticleEmitter>();
|
||||||
m_World->Initialize();
|
m_World->Initialize();
|
||||||
|
|
||||||
//PointLightTest
|
//auto particleEmitter= m_World->AddComponent<Components::Emitter>(Pe);
|
||||||
{
|
|
||||||
auto t_Light = m_World->CreateEntity();
|
|
||||||
auto transform = m_World->AddComponent<Components::Transform>(t_Light);
|
|
||||||
transform->Position = glm::vec3(-3.f, 6.f, -5.f);
|
|
||||||
transform->Sticky = true;
|
|
||||||
auto pl = m_World->AddComponent<Components::PointLight>(t_Light);
|
|
||||||
pl->Radius = 20.f;
|
|
||||||
pl->Diffuse = glm::vec3(0.8f, 0.7f, 0.05f);
|
|
||||||
auto model = m_World->AddComponent<Components::Model>(t_Light);
|
|
||||||
model->ModelFile = "Models/Core/UnitSphere.obj";
|
|
||||||
m_World->CommitEntity(t_Light);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
auto t_Light = m_World->CreateEntity();
|
|
||||||
auto transform = m_World->AddComponent<Components::Transform>(t_Light);
|
|
||||||
transform->Position = glm::vec3(3.f, -5.f, -5.f);
|
|
||||||
transform->Sticky = true;
|
|
||||||
auto pl = m_World->AddComponent<Components::PointLight>(t_Light);
|
|
||||||
pl->Radius = 15.f;
|
|
||||||
pl->Diffuse = glm::vec3(0.1f, 0.5f, 0.8f);
|
|
||||||
auto model = m_World->AddComponent<Components::Model>(t_Light);
|
|
||||||
model->ModelFile = "Models/Core/UnitSphere.obj";
|
|
||||||
m_World->CommitEntity(t_Light);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Halfpipe background test model.
|
|
||||||
{
|
|
||||||
auto t_halfPipe = m_World->CreateEntity();
|
|
||||||
auto transform = m_World->AddComponent<Components::Transform>(t_halfPipe);
|
|
||||||
transform->Position = glm::vec3(0.f, 0.f, -15.f);
|
|
||||||
transform->Scale = glm::vec3(6.f, 6.f, 10.f);
|
|
||||||
transform->Sticky = false;
|
|
||||||
auto model = m_World->AddComponent<Components::Model>(t_halfPipe);
|
|
||||||
model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj";
|
|
||||||
model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 1.f);
|
|
||||||
m_World->CommitEntity(t_halfPipe);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
auto t_halfPipe = m_World->CreateEntity();
|
|
||||||
auto transform = m_World->AddComponent<Components::Transform>(t_halfPipe);
|
|
||||||
transform->Position = glm::vec3(0.f, 34.6f, -15.f);
|
|
||||||
transform->Scale = glm::vec3(6.f, 6.f, 10.f);
|
|
||||||
transform->Sticky = false;
|
|
||||||
auto model = m_World->AddComponent<Components::Model>(t_halfPipe);
|
|
||||||
model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj";
|
|
||||||
model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 1.f);
|
|
||||||
m_World->CommitEntity(t_halfPipe);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Background
|
|
||||||
|
|
||||||
{
|
|
||||||
auto background = m_World->CreateEntity();
|
|
||||||
auto transform = m_World->AddComponent<Components::Transform>(background);
|
|
||||||
transform->Position = glm::vec3(0.f, 0.f, -30.f);
|
|
||||||
transform->Scale = glm::vec3(2681.f / 50.f, 1080.f / 50.f, 1.f);
|
|
||||||
auto sprite = m_World->AddComponent<Components::Sprite>(background);
|
|
||||||
sprite->SpriteFile = "Textures/Background.png";
|
|
||||||
m_World->CommitEntity(background);
|
|
||||||
}
|
|
||||||
|
|
||||||
// auto particleEmitter= m_World->AddComponent<Components::Emitter>(Pe);
|
|
||||||
//Water test
|
|
||||||
{
|
|
||||||
auto t_waterBody = m_World->CreateEntity();
|
|
||||||
auto transform = m_World->AddComponent<Components::Transform>(t_waterBody);
|
|
||||||
transform->Position = glm::vec3(0.f, -3.5f, -10.f);
|
|
||||||
transform->Scale = glm::vec3(7.0f, 1.5f, 1.f);
|
|
||||||
transform->Sticky = true;
|
|
||||||
auto water = m_World->AddComponent<Components::WaterVolume>(t_waterBody);
|
|
||||||
auto body = m_World->AddComponent<Components::RectangleShape>(t_waterBody);
|
|
||||||
m_World->CommitEntity(t_waterBody);
|
|
||||||
}
|
|
||||||
|
|
||||||
//ParticleTest
|
|
||||||
|
|
||||||
|
|
||||||
/*{
|
|
||||||
auto Pe = m_World->CreateEntity();
|
|
||||||
auto transform = m_World->AddComponent<Components::Transform>(Pe);
|
|
||||||
auto particleEmitter= m_World->AddComponent<Components::ParticleEmitter>(Pe);
|
|
||||||
auto emitteSprite = m_World->AddComponent<Components::Sprite>(Pe);
|
|
||||||
|
|
||||||
transform->Position = glm::vec3(0.f, 0.f, -10.f);
|
|
||||||
emitteSprite->SpriteFile = "Textures/Test/Brick_Normal.png";
|
|
||||||
particleEmitter->GravityScale = 0.0f;
|
|
||||||
particleEmitter->SpawnRate = 1.f;
|
|
||||||
particleEmitter->NumberOfTicks = 2;
|
|
||||||
particleEmitter->Speed = 1.f;
|
|
||||||
particleEmitter->ParticlesPerTick = 5;
|
|
||||||
particleEmitter->Spread = glm::pi<float>()*2;
|
|
||||||
particleEmitter->EmittingAngle = glm::pi<float>();
|
|
||||||
particleEmitter->LifeTime = 50;
|
|
||||||
|
|
||||||
{
|
|
||||||
auto Pt = m_World->CreateEntity(Pe);
|
|
||||||
auto PtTransform = m_World->AddComponent<Components::Transform>(Pt);
|
|
||||||
auto PtSprite = m_World->AddComponent<Components::Sprite>(Pt);
|
|
||||||
auto PtParticle = m_World->AddComponent<Components::Particle>(Pt);
|
|
||||||
auto PtTemplate = m_World->AddComponent<Components::Template>(Pt);
|
|
||||||
|
|
||||||
//PtTransform->Velocity = glm::vec3(1.0f, 0.f, 0.f);
|
|
||||||
PtTransform->Position = transform->Position;
|
|
||||||
PtSprite->SpriteFile = "Textures/Background.png";
|
|
||||||
PtParticle->LifeTime = 3.f;
|
|
||||||
PtParticle->Flags = static_cast<ParticleFlags::Type>(ParticleFlags::Type::Powder | ParticleFlags::Type::ParticleContactFilter | ParticleFlags::Type::FixtureContactFilter);
|
|
||||||
}
|
|
||||||
m_World->CommitEntity(Pe);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
//TODO: Why does the ball not collide with these bricks?
|
|
||||||
//BottomBox
|
|
||||||
{
|
|
||||||
auto BottomWall = m_World->CreateEntity();
|
|
||||||
auto transform = m_World->AddComponent<Components::Transform>(BottomWall);
|
|
||||||
transform->Position = glm::vec3(0.f, -6.f, -10.f);
|
|
||||||
transform->Scale = glm::vec3(20.f, 0.5f, 1.f);
|
|
||||||
//std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(BottomWall);
|
|
||||||
//sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
|
|
||||||
std::shared_ptr<Components::RectangleShape> rectangleShape = m_World->AddComponent<Components::RectangleShape>(BottomWall);
|
|
||||||
rectangleShape->Dimensions = glm::vec2(20.f, 0.5f);
|
|
||||||
std::shared_ptr<Components::Physics> physics = m_World->AddComponent<Components::Physics>(BottomWall);
|
|
||||||
physics->CollisionType = CollisionType::Type::Static;
|
|
||||||
physics->Category = CollisionLayer::Wall;
|
|
||||||
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::LifeBuoy);
|
|
||||||
transform->Sticky = true;
|
|
||||||
m_World->CommitEntity(BottomWall);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto topWall = m_World->CreateEntity();
|
|
||||||
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(topWall);
|
|
||||||
transform->Position = glm::vec3(0.f, 6.f, -10.f);
|
|
||||||
transform->Scale = glm::vec3(20.f, 0.5f, 1.f);
|
|
||||||
|
|
||||||
//std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(topWall);
|
|
||||||
//sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
|
|
||||||
|
|
||||||
std::shared_ptr<Components::RectangleShape> rectangleShape = m_World->AddComponent<Components::RectangleShape>(topWall);
|
|
||||||
rectangleShape->Dimensions = glm::vec2(20.f, 0.5f);
|
|
||||||
|
|
||||||
std::shared_ptr<Components::Physics> physics = m_World->AddComponent<Components::Physics>(topWall);
|
|
||||||
physics->CollisionType = CollisionType::Type::Static;
|
|
||||||
physics->Category = CollisionLayer::Wall;
|
|
||||||
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::Brick);
|
|
||||||
transform->Sticky = true;
|
|
||||||
|
|
||||||
m_World->CommitEntity(topWall);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto leftWall = m_World->CreateEntity();
|
|
||||||
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(
|
|
||||||
leftWall);
|
|
||||||
transform->Position = glm::vec3(-4.f, 1.f, -10.f);
|
|
||||||
transform->Scale = glm::vec3(0.5f, 20.f, 1.f);
|
|
||||||
|
|
||||||
//std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(leftWall);
|
|
||||||
//sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
|
|
||||||
|
|
||||||
std::shared_ptr<Components::RectangleShape> rectangleShape = m_World->AddComponent<Components::RectangleShape>(leftWall);
|
|
||||||
rectangleShape->Dimensions = glm::vec2(0.5f, 20.f);
|
|
||||||
|
|
||||||
std::shared_ptr<Components::Physics> physics = m_World->AddComponent<Components::Physics>(leftWall);
|
|
||||||
physics->CollisionType = CollisionType::Type::Static;
|
|
||||||
physics->Category = CollisionLayer::Wall;
|
|
||||||
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::Brick);
|
|
||||||
transform->Sticky = true;
|
|
||||||
|
|
||||||
m_World->CommitEntity(leftWall);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto rightWall = m_World->CreateEntity();
|
|
||||||
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(
|
|
||||||
rightWall);
|
|
||||||
transform->Position = glm::vec3(4.f, 1.f, -10.f);
|
|
||||||
transform->Scale = glm::vec3(0.5f, 20.f, 1.f);
|
|
||||||
|
|
||||||
//std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(rightWall);
|
|
||||||
//sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
|
|
||||||
|
|
||||||
std::shared_ptr<Components::RectangleShape> rectangleShape = m_World->AddComponent<Components::RectangleShape>(rightWall);
|
|
||||||
rectangleShape->Dimensions = glm::vec2(0.5f, 20.f);
|
|
||||||
|
|
||||||
std::shared_ptr<Components::Physics> physics = m_World->AddComponent<Components::Physics>(rightWall);
|
|
||||||
physics->CollisionType = CollisionType::Type::Static;
|
|
||||||
physics->Category = CollisionLayer::Wall;
|
|
||||||
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::Brick);
|
|
||||||
transform->Sticky = true;
|
|
||||||
|
|
||||||
m_World->CommitEntity(rightWall);
|
|
||||||
}
|
|
||||||
|
|
||||||
//EVENT_SUBSCRIBE_MEMBER(m_EGameStart, &Engine::OnGameStart);
|
//EVENT_SUBSCRIBE_MEMBER(m_EGameStart, &Engine::OnGameStart);
|
||||||
m_EGameStart = decltype(m_EGameStart)(std::bind(&Engine::OnGameStart, this, std::placeholders::_1));
|
m_EGameStart = decltype(m_EGameStart)(std::bind(&Engine::OnGameStart, this, std::placeholders::_1));
|
||||||
m_EventBroker->Subscribe(m_EGameStart);
|
m_EventBroker->Subscribe(m_EGameStart);
|
||||||
m_EScreenShake = decltype(m_EScreenShake)(std::bind(&Engine::OnScreenShake, this, std::placeholders::_1));
|
|
||||||
m_EventBroker->Subscribe(m_EScreenShake);
|
|
||||||
|
|
||||||
m_LastTime = glfwGetTime();
|
m_LastTime = glfwGetTime();
|
||||||
}
|
}
|
||||||
@@ -410,9 +230,8 @@ public:
|
|||||||
//ResourceManager::Update();
|
//ResourceManager::Update();
|
||||||
if (m_GameIsRunning) {
|
if (m_GameIsRunning) {
|
||||||
m_World->Update(dt);
|
m_World->Update(dt);
|
||||||
|
} else {
|
||||||
// I apologize about this.
|
m_EventBroker->Process<Systems::SoundSystem>();
|
||||||
ScreenShakeUpdate(dt);
|
|
||||||
}
|
}
|
||||||
m_EventBroker->Process<GUI::Frame>();
|
m_EventBroker->Process<GUI::Frame>();
|
||||||
m_FrameStack->UpdateLayered(dt);
|
m_FrameStack->UpdateLayered(dt);
|
||||||
@@ -593,36 +412,6 @@ public:
|
|||||||
m_RendererQueue.Forward.Add(job);
|
m_RendererQueue.Forward.Add(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenShakeUpdate(double dt)
|
|
||||||
{
|
|
||||||
if (m_ScreenShake) {
|
|
||||||
m_ShakeTimer += dt;
|
|
||||||
if (m_ShakeTimer >= m_ShakeEndTime) {
|
|
||||||
//std::cout << "Used: " << m_ShakeIntensity << " True: " << m_ShakeRepresentativeIntensity << std::endl;
|
|
||||||
m_ShakeRepresentativeIntensity -= m_ShakeRepresentativeIntensity * m_CoolerMultiplier * dt;
|
|
||||||
m_ShakeIntensity = m_ShakeRepresentativeIntensity;
|
|
||||||
if (m_ShakeIntensity <= 0) {
|
|
||||||
m_ScreenShake = false;
|
|
||||||
//m_Renderer->PlaceCamera(glm::vec3(0, 0, 0));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//std::cout << "Timer: " << m_ShakeTimer << " End: " << m_ShakeEndTime << std::endl;
|
|
||||||
}
|
|
||||||
float randomX = (rand() % m_ShakeIntensity);
|
|
||||||
float randomY = (rand() % m_ShakeIntensity);
|
|
||||||
|
|
||||||
float half = m_ShakeIntensity / 2;
|
|
||||||
|
|
||||||
randomX = (randomX - half) / 20;
|
|
||||||
randomY = (randomY - half) / 20;
|
|
||||||
|
|
||||||
//std::cout << "X: " << randomX << " Y: " << randomY << std::endl;
|
|
||||||
|
|
||||||
//m_Renderer->PlaceCamera(glm::vec3(randomX, randomY, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<EventBroker> m_EventBroker;
|
std::shared_ptr<EventBroker> m_EventBroker;
|
||||||
GUI::Frame* m_FrameStack = nullptr;
|
GUI::Frame* m_FrameStack = nullptr;
|
||||||
@@ -640,42 +429,21 @@ private:
|
|||||||
m_GameIsRunning = true;
|
m_GameIsRunning = true;
|
||||||
//Todo: Move this
|
//Todo: Move this
|
||||||
{
|
{
|
||||||
dd::Events::PlaySound e;
|
// dd::Events::PlaySound e;
|
||||||
e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav";
|
// e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav";
|
||||||
e.IsAmbient = true;
|
// e.IsAmbient = true;
|
||||||
m_EventBroker->Publish(e);
|
// m_EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
dd::Events::PlaySound e;
|
// dd::Events::PlaySound e;
|
||||||
e.FilePath = "Sounds/BGM/water-flowing.wav";
|
// e.FilePath = "Sounds/BGM/water-flowing.wav";
|
||||||
e.Gain = 0.3f;
|
// e.Gain = 0.3f;
|
||||||
e.IsAmbient = true;
|
// e.IsAmbient = true;
|
||||||
m_EventBroker->Publish(e);
|
// m_EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
//TODO: Extreme Redo.
|
|
||||||
bool m_ScreenShake = false;
|
|
||||||
int m_ShakeIntensity = 0;
|
|
||||||
float m_ShakeRepresentativeIntensity = 0;
|
|
||||||
float m_ShakeTimer = 0;
|
|
||||||
float m_ShakeEndTime = 0;
|
|
||||||
float m_TimeTakenToCoolDown = 0;
|
|
||||||
float m_CoolerMultiplier = 0;
|
|
||||||
dd::EventRelay<Engine, dd::Events::ScreenShake> m_EScreenShake;
|
|
||||||
bool OnScreenShake(const dd::Events::ScreenShake &event)
|
|
||||||
{
|
|
||||||
m_ScreenShake = true;
|
|
||||||
m_ShakeIntensity = event.Intensity;
|
|
||||||
m_ShakeRepresentativeIntensity = event.Intensity;
|
|
||||||
m_ShakeEndTime = event.Time;
|
|
||||||
m_ShakeTimer = 0;
|
|
||||||
m_TimeTakenToCoolDown = event.TimeTakenToCoolDown;
|
|
||||||
m_CoolerMultiplier = m_ShakeIntensity / m_TimeTakenToCoolDown;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
double m_LastTime;
|
double m_LastTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,10 @@ protected:
|
|||||||
Events::ButtonEnter e;
|
Events::ButtonEnter e;
|
||||||
e.FrameName = m_Name;
|
e.FrameName = m_Name;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
|
Events::PlaySound soundEvent;
|
||||||
|
soundEvent.FilePath = "Sounds/GUI/hover-n.wav";
|
||||||
|
EventBroker->Publish(soundEvent);
|
||||||
|
|
||||||
} else if (!isOver && m_MouseIsOver) { // Leave
|
} else if (!isOver && m_MouseIsOver) { // Leave
|
||||||
if (!m_IsDown) {
|
if (!m_IsDown) {
|
||||||
if (!m_TextureReleased.empty()) {
|
if (!m_TextureReleased.empty()) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "GUI/EButtonRelease.h"
|
#include "GUI/EButtonRelease.h"
|
||||||
#include "GUI/ESliderUpdate.h"
|
#include "GUI/ESliderUpdate.h"
|
||||||
#include "Core/EMouseMove.h"
|
#include "Core/EMouseMove.h"
|
||||||
|
#include "Sound/EPlaySound.h"
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
{
|
{
|
||||||
@@ -79,6 +80,11 @@ private:
|
|||||||
if (event.Button == m_SliderButton) {
|
if (event.Button == m_SliderButton) {
|
||||||
m_IsGrabbed = true;
|
m_IsGrabbed = true;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
Events::PlaySound e;
|
||||||
|
e.FilePath = "Sounds/GUI/click-n.wav";
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public:
|
|||||||
if (m_Texture == nullptr) {
|
if (m_Texture == nullptr) {
|
||||||
m_Texture = ResourceManager::Load<dd::Texture>("Textures/Core/ErrorTexture.png");
|
m_Texture = ResourceManager::Load<dd::Texture>("Textures/Core/ErrorTexture.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
SizeToTexture();
|
SizeToTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include "Core/EventBroker.h"
|
#include "Core/EventBroker.h"
|
||||||
#include "Core/CTransform.h"
|
#include "Core/CTransform.h"
|
||||||
#include "Core/CTemplate.h"
|
#include "Core/CTemplate.h"
|
||||||
|
#include "Core/ResourceManager.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"
|
||||||
@@ -32,6 +34,7 @@
|
|||||||
#include "Game/EArrivedAtNewStage.h"
|
#include "Game/EArrivedAtNewStage.h"
|
||||||
#include "Game/EGameOver.h"
|
#include "Game/EGameOver.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
|
#include "Game/EResume.h"
|
||||||
#include "Game/EHitPad.h"
|
#include "Game/EHitPad.h"
|
||||||
#include "Game/EHitLag.h"
|
#include "Game/EHitLag.h"
|
||||||
#include "Game/EActionButton.h"
|
#include "Game/EActionButton.h"
|
||||||
@@ -94,7 +97,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
float m_XMovementMultiplier = 2.f;
|
float m_XMovementMultiplier = 2.f;
|
||||||
float m_EdgeX = 3.2f;
|
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_Lives = 3;
|
||||||
@@ -108,6 +111,7 @@ private:
|
|||||||
bool m_InkBlockedWaiting = false;
|
bool m_InkBlockedWaiting = false;
|
||||||
bool m_Restarting = false;
|
bool m_Restarting = false;
|
||||||
int m_StickyCounter = 3;
|
int m_StickyCounter = 3;
|
||||||
|
bool m_GodMode = false;
|
||||||
|
|
||||||
bool m_StageBlockedWaiting = false;
|
bool m_StageBlockedWaiting = false;
|
||||||
|
|
||||||
@@ -127,6 +131,7 @@ private:
|
|||||||
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::Pause> m_EPause;
|
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::Contact> m_Contact;
|
||||||
dd::EventRelay<BallSystem, dd::Events::ActionButton> m_EActionButton;
|
dd::EventRelay<BallSystem, dd::Events::ActionButton> m_EActionButton;
|
||||||
dd::EventRelay<BallSystem, dd::Events::StageCleared> m_EStageCleared;
|
dd::EventRelay<BallSystem, dd::Events::StageCleared> m_EStageCleared;
|
||||||
@@ -141,6 +146,7 @@ private:
|
|||||||
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 OnPause(const dd::Events::Pause &event);
|
bool OnPause(const dd::Events::Pause &event);
|
||||||
|
bool OnResume(const dd::Events::Resume &event);
|
||||||
bool OnActionButton(const dd::Events::ActionButton &event);
|
bool OnActionButton(const dd::Events::ActionButton &event);
|
||||||
bool OnStageCleared(const dd::Events::StageCleared &event);
|
bool OnStageCleared(const dd::Events::StageCleared &event);
|
||||||
bool OnArrivedToNewStage(const dd::Events::ArrivedAtNewStage &event);
|
bool OnArrivedToNewStage(const dd::Events::ArrivedAtNewStage &event);
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-14.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_CBACKGROUND_H
|
||||||
|
#define DAYDREAM_CBACKGROUND_H
|
||||||
|
|
||||||
|
#include "Core/Component.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
|
||||||
|
struct Background : Component
|
||||||
|
{
|
||||||
|
float distanceLeftToCorrectTravelPosition;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_CBACKGROUND_H
|
||||||
@@ -19,6 +19,7 @@ struct Brick : Component
|
|||||||
//0 = empty, 1 = normal, 2 = multi-brick, 3 = lifebuoy, 4 = sticky, 5 = blaster, 6 = kraken
|
//0 = empty, 1 = normal, 2 = multi-brick, 3 = lifebuoy, 4 = sticky, 5 = blaster, 6 = kraken
|
||||||
int Type = 0;
|
int Type = 0;
|
||||||
bool Removed = false;
|
bool Removed = false;
|
||||||
|
int Number = 0; // For the Kraken to keep track of which bricks needs replacing.
|
||||||
|
|
||||||
//What number of types each is.
|
//What number of types each is.
|
||||||
const int EmptyBrickSpace = 0;
|
const int EmptyBrickSpace = 0;
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-15.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_CKRAKEN_H
|
||||||
|
#define DAYDREAM_CKRAKEN_H
|
||||||
|
|
||||||
|
#include "Core/Component.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
|
||||||
|
struct Kraken : Component {
|
||||||
|
|
||||||
|
int Health = 10;
|
||||||
|
int CurrentAction = 1;
|
||||||
|
|
||||||
|
const int Idle = 1;
|
||||||
|
const int Grabbing = 2;
|
||||||
|
const int Taunting = 3;
|
||||||
|
const int Moving = 4;
|
||||||
|
const int BrickGenerating = 5;
|
||||||
|
// Idle. Generating bricks. Taunting. No idea.
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_CKRAKEN_H
|
||||||
@@ -15,7 +15,7 @@ namespace Components
|
|||||||
|
|
||||||
struct Projectile : Component
|
struct Projectile : Component
|
||||||
{
|
{
|
||||||
|
float Speed = 5;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-15.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_CTRAVELS_H
|
||||||
|
#define DAYDREAM_CTRAVELS_H
|
||||||
|
|
||||||
|
#include "Core/Component.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
|
||||||
|
struct Travels : Component
|
||||||
|
{
|
||||||
|
//This indicates that the object moves upon moving to the next stage. Place this on an object that is to move.
|
||||||
|
//The camera does not move. Things that are to follow the camera should not have this component.
|
||||||
|
|
||||||
|
bool CurrentlyTraveling = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_CTRAVELS_H
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-14.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_CWALL_H
|
||||||
|
#define DAYDREAM_CWALL_H
|
||||||
|
|
||||||
|
#include "Core/Component.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
|
||||||
|
struct Wall : Component
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_CWALL_H
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-16.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_EBRICKGENERATING_H
|
||||||
|
#define DAYDREAM_EBRICKGENERATING_H
|
||||||
|
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Events
|
||||||
|
{
|
||||||
|
|
||||||
|
struct BrickGenerating : Event
|
||||||
|
{
|
||||||
|
glm::vec3 Origin;
|
||||||
|
int TargetLine;
|
||||||
|
int Set;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_EBRICKGENERATING_H
|
||||||
@@ -12,7 +12,7 @@ namespace Events
|
|||||||
|
|
||||||
struct ClusterClear : Event
|
struct ClusterClear : Event
|
||||||
{
|
{
|
||||||
|
int ClusterCleared;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
//
|
|
||||||
// Created by Adam on 2015-09-25.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef EVENTS_EGAMESTART_H__
|
#ifndef EVENTS_EGAMESTART_H__
|
||||||
#define EVENTS_EGAMESTART_H__
|
#define EVENTS_EGAMESTART_H__
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ struct InkBlaster : Event
|
|||||||
{
|
{
|
||||||
Components::Transform* Transform;
|
Components::Transform* Transform;
|
||||||
int Shots;
|
int Shots;
|
||||||
|
float Speed = 5;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-15.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_EKRAKENAPPEAR_H
|
||||||
|
#define DAYDREAM_EKRAKENAPPEAR_H
|
||||||
|
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Events
|
||||||
|
{
|
||||||
|
|
||||||
|
struct KrakenAppear : Event
|
||||||
|
{
|
||||||
|
int Health;
|
||||||
|
glm::vec3 Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_EKRAKENAPPEAR_H
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_EKRAKENDEFEATED_H
|
||||||
|
#define DAYDREAM_EKRAKENDEFEATED_H
|
||||||
|
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Events
|
||||||
|
{
|
||||||
|
|
||||||
|
struct KrakenDefeated : Event
|
||||||
|
{
|
||||||
|
EntityID Kraken;
|
||||||
|
EntityID Hitter;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_EKRAKENDEFEATED_H
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_EKRAKENHIT_H
|
||||||
|
#define DAYDREAM_EKRAKENHIT_H
|
||||||
|
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Events
|
||||||
|
{
|
||||||
|
|
||||||
|
struct KrakenHit : Event
|
||||||
|
{
|
||||||
|
EntityID Kraken;
|
||||||
|
EntityID Hitter;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_EKRAKENHIT_H
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// Created by Administrator on 2015-10-14.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_ERAISEWATER_H
|
||||||
|
#define DAYDREAM_ERAISEWATER_H
|
||||||
|
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Events
|
||||||
|
{
|
||||||
|
|
||||||
|
struct RaiseWater : Event
|
||||||
|
{
|
||||||
|
float Amount;
|
||||||
|
float Speed;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_ERAISEWATER_H
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// Created by Administrator on 2015-10-20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_ERAISEWATERWALL_H
|
||||||
|
#define DAYDREAM_ERAISEWATERWALL_H
|
||||||
|
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Events
|
||||||
|
{
|
||||||
|
|
||||||
|
struct RaiseWaterWall : Event
|
||||||
|
{
|
||||||
|
float Amount;
|
||||||
|
float Speed;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_ERAISEWATERWALL_H
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
//
|
||||||
|
// Created by Administrator on 2015-10-20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_ERELEVANTOBJECTCREATED_H
|
||||||
|
#define DAYDREAM_ERELEVANTOBJECTCREATED_H
|
||||||
|
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
#include "Core/Entity.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Events
|
||||||
|
{
|
||||||
|
|
||||||
|
struct RelevantObjectCreated : Event
|
||||||
|
{
|
||||||
|
std::string ObjectName;
|
||||||
|
EntityID ObjectID;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_ERELEVANTOBJECTCREATED_H
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-14.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_ERESETALL_H
|
||||||
|
#define DAYDREAM_ERESETALL_H
|
||||||
|
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Events
|
||||||
|
{
|
||||||
|
|
||||||
|
struct ResetAll : Event
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_ERESETALL_H
|
||||||
@@ -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
|
||||||
@@ -17,6 +17,7 @@ struct StageCleared : Event
|
|||||||
{
|
{
|
||||||
int ClearedStage = 0;
|
int ClearedStage = 0;
|
||||||
int StageCluster = 0;
|
int StageCluster = 0;
|
||||||
|
int StagesInCluster = 6;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// Created by Administrator on 2015-10-19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_ESTARTEDNEWLEVEL_H
|
||||||
|
#define DAYDREAM_ESTARTEDNEWLEVEL_H
|
||||||
|
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
#include "Core/Entity.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
namespace Events
|
||||||
|
{
|
||||||
|
struct StartedNewLevel : Event
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_ESTARTEDNEWLEVEL_H
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "Game/EMultiBall.h"
|
#include "Game/EMultiBall.h"
|
||||||
#include "Game/EMultiBallLost.h"
|
#include "Game/EMultiBallLost.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
|
#include "Game/EResume.h"
|
||||||
#include "Game/EHitLag.h"
|
#include "Game/EHitLag.h"
|
||||||
#include "Game/EGameOver.h"
|
#include "Game/EGameOver.h"
|
||||||
#include "Game/ECreatePowerUp.h"
|
#include "Game/ECreatePowerUp.h"
|
||||||
@@ -70,16 +71,18 @@ public:
|
|||||||
std::string& CurrentType() { return m_CurrentType; }
|
std::string& CurrentType() { return m_CurrentType; }
|
||||||
void SetCurrentType(const std::string& currentType) { m_CurrentType = currentType; }
|
void SetCurrentType(const std::string& currentType) { m_CurrentType = currentType; }
|
||||||
private:
|
private:
|
||||||
bool m_Pause;
|
bool m_Pause = false;
|
||||||
bool m_HitLag;
|
bool m_HitLag = false;
|
||||||
float m_HitLagDuration;
|
float m_HitLagDuration;
|
||||||
float m_HitLagTimer;
|
float m_HitLagTimer;
|
||||||
std::string m_CurrentType;
|
std::string m_CurrentType;
|
||||||
|
|
||||||
dd::EventRelay<HitLagSystem, dd::Events::Pause> m_EPause;
|
dd::EventRelay<HitLagSystem, dd::Events::Pause> m_EPause;
|
||||||
|
dd::EventRelay<HitLagSystem, dd::Events::Resume> m_EResume;
|
||||||
dd::EventRelay<HitLagSystem, dd::Events::HitLag> m_EHitLag;
|
dd::EventRelay<HitLagSystem, dd::Events::HitLag> m_EHitLag;
|
||||||
|
|
||||||
bool OnPause(const dd::Events::Pause &event);
|
bool OnPause(const dd::Events::Pause &event);
|
||||||
|
bool OnResume(const dd::Events::Resume &event);
|
||||||
bool OnHitLag(const dd::Events::HitLag &event);
|
bool OnHitLag(const dd::Events::HitLag &event);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-15.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_KRAKENSYSTEM_H
|
||||||
|
#define DAYDREAM_KRAKENSYSTEM_H
|
||||||
|
|
||||||
|
#include <random>
|
||||||
|
|
||||||
|
#include "Core/System.h"
|
||||||
|
#include "Core/CTransform.h"
|
||||||
|
#include "Core/CTemplate.h"
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
#include "Core/World.h"
|
||||||
|
#include "Rendering/CModel.h"
|
||||||
|
#include "Physics/CRectangleShape.h"
|
||||||
|
#include "Physics/CCircleShape.h"
|
||||||
|
#include "Physics/CPhysics.h"
|
||||||
|
#include "Physics/EContact.h"
|
||||||
|
#include "Physics/ESetImpulse.h"
|
||||||
|
#include "Physics/ECreateParticleSequence.h"
|
||||||
|
#include "Game/EPause.h"
|
||||||
|
#include "Game/EResume.h"
|
||||||
|
#include "Game/EKrakenAppear.h"
|
||||||
|
#include "Game/EKrakenAttack.h"
|
||||||
|
#include "Game/EKrakenHit.h"
|
||||||
|
#include "Game/EKrakenDefeated.h"
|
||||||
|
#include "Game/EBrickGenerating.h"
|
||||||
|
#include "Game/CTravels.h"
|
||||||
|
#include "Game/CKraken.h"
|
||||||
|
#include "Game/CBall.h"
|
||||||
|
#include "Sound/CCollisionSound.h"
|
||||||
|
//#include "Core/Camera.h" Camera Component
|
||||||
|
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Systems
|
||||||
|
{
|
||||||
|
|
||||||
|
class KrakenSystem : public System
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
KrakenSystem(World* world, std::shared_ptr<dd::EventBroker> eventBroker)
|
||||||
|
: System(world, eventBroker)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
void Initialize() override;
|
||||||
|
void InitializeObjects();
|
||||||
|
|
||||||
|
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; }
|
||||||
|
private:
|
||||||
|
std::mt19937 m_RandomGenerator;
|
||||||
|
|
||||||
|
bool m_Pause = false;
|
||||||
|
bool m_KrakenBattle = false;
|
||||||
|
bool m_ReturnToIdle = false;
|
||||||
|
EntityID m_KrakenTemplate;
|
||||||
|
std::string m_Action = "Idle";
|
||||||
|
float m_KrakenTimer = 0;
|
||||||
|
float m_KrakenSecondsToAction = 1;
|
||||||
|
const int Idle = 1;
|
||||||
|
|
||||||
|
std::array<int, 14> m_Bricks;
|
||||||
|
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::KrakenHit> m_EKrakenHit;
|
||||||
|
dd::EventRelay<KrakenSystem, dd::Events::KrakenDefeated> m_EKrakenDefeated;
|
||||||
|
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);
|
||||||
|
bool OnKrakenHit(const dd::Events::KrakenHit &event);
|
||||||
|
bool OnKrakenDefeated(const dd::Events::KrakenDefeated &event);
|
||||||
|
bool OnBrickGenerating(const dd::Events::BrickGenerating &event);
|
||||||
|
void GetBrickSet();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_KRAKENSYSTEM_H
|
||||||
@@ -14,18 +14,28 @@
|
|||||||
#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/ResourceManager.h"
|
||||||
|
#include "Core/ConfigFile.h"
|
||||||
#include "Rendering/CSprite.h"
|
#include "Rendering/CSprite.h"
|
||||||
#include "Rendering/CModel.h"
|
#include "Rendering/CModel.h"
|
||||||
|
#include "Rendering/CPointLight.h"
|
||||||
|
|
||||||
|
#include "Transform/EMove.h"
|
||||||
|
|
||||||
#include "Game/CBrick.h"
|
#include "Game/CBrick.h"
|
||||||
#include "Game/CBall.h"
|
#include "Game/CBall.h"
|
||||||
#include "Game/CLife.h"
|
#include "Game/CLife.h"
|
||||||
|
#include "Game/CWall.h"
|
||||||
|
#include "Game/CBackground.h"
|
||||||
#include "Game/CProjectile.h"
|
#include "Game/CProjectile.h"
|
||||||
#include "Game/CPowerUp.h"
|
#include "Game/CPowerUp.h"
|
||||||
|
#include "Game/CTravels.h"
|
||||||
|
|
||||||
#include "Game/BrickComponents.h"
|
#include "Game/BrickComponents.h"
|
||||||
|
|
||||||
|
#include "Game/ERelevantObjectCreated.h"
|
||||||
#include "Game/EStageCleared.h"
|
#include "Game/EStageCleared.h"
|
||||||
|
#include "Game/EArrivedAtNewStage.h"
|
||||||
#include "Game/ELifeLost.h"
|
#include "Game/ELifeLost.h"
|
||||||
#include "Game/EResetBall.h"
|
#include "Game/EResetBall.h"
|
||||||
#include "Game/EScoreEvent.h"
|
#include "Game/EScoreEvent.h"
|
||||||
@@ -38,14 +48,21 @@
|
|||||||
#include "Game/EMultiBall.h"
|
#include "Game/EMultiBall.h"
|
||||||
#include "Game/EMultiBallLost.h"
|
#include "Game/EMultiBallLost.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
|
#include "Game/EResume.h"
|
||||||
#include "Game/EGameOver.h"
|
#include "Game/EGameOver.h"
|
||||||
#include "Game/EClusterClear.h"
|
#include "Game/EClusterClear.h"
|
||||||
#include "Game/ECreatePowerUp.h"
|
#include "Game/ECreatePowerUp.h"
|
||||||
#include "Game/EPowerUpTaken.h"
|
#include "Game/EPowerUpTaken.h"
|
||||||
|
|
||||||
|
#include "Game/CKraken.h"
|
||||||
|
#include "Game/EKrakenAppear.h"
|
||||||
|
#include "Game/EKrakenDefeated.h"
|
||||||
|
#include "Game/EBrickGenerating.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/CWaterVolume.h"
|
||||||
#include "Physics/ESetImpulse.h"
|
#include "Physics/ESetImpulse.h"
|
||||||
#include "Physics/EContact.h"
|
#include "Physics/EContact.h"
|
||||||
#include "Sound/CCollisionSound.h"
|
#include "Sound/CCollisionSound.h"
|
||||||
@@ -82,7 +99,7 @@ public:
|
|||||||
|
|
||||||
void CreateBasicLevel(int, int, glm::vec2, float);
|
void CreateBasicLevel(int, int, glm::vec2, float);
|
||||||
void CreateLevel(int);
|
void CreateLevel(int);
|
||||||
void CreateBrick(int, int, glm::vec2, float, int, int, int, glm::vec4);
|
EntityID CreateBrick(int, int, glm::vec2, float, int, int, int, glm::vec4);
|
||||||
void BrickHit(EntityID, EntityID, int);
|
void BrickHit(EntityID, EntityID, int);
|
||||||
|
|
||||||
void OnEntityRemoved(EntityID entity);
|
void OnEntityRemoved(EntityID entity);
|
||||||
@@ -134,9 +151,11 @@ private:
|
|||||||
int m_NumberOfBricks;
|
int m_NumberOfBricks;
|
||||||
int m_Rows = 6;
|
int m_Rows = 6;
|
||||||
int m_Lines = 7;
|
int m_Lines = 7;
|
||||||
|
int m_StagesInCluster = 6;
|
||||||
float m_SpaceToEdge = 0.25f;
|
float m_SpaceToEdge = 0.25f;
|
||||||
glm::vec2 m_SpaceBetweenBricks = glm::vec2(1, 0.4);
|
glm::vec2 m_SpaceBetweenBricks = glm::vec2(1, 0.4);
|
||||||
float m_NotResettingTheStage = 5.f;
|
float m_NotResettingTheStage = 5.f;
|
||||||
|
bool m_GodMode = false;
|
||||||
|
|
||||||
const int EmptyBrickSpace = 0;
|
const int EmptyBrickSpace = 0;
|
||||||
const int StandardBrick = 1;
|
const int StandardBrick = 1;
|
||||||
@@ -146,11 +165,16 @@ private:
|
|||||||
const int InkBlasterBrick = 5;
|
const int InkBlasterBrick = 5;
|
||||||
const int KrakenAttackBrick = 6;
|
const int KrakenAttackBrick = 6;
|
||||||
|
|
||||||
|
const int Kraken = 100;
|
||||||
|
|
||||||
EntityID m_BrickTemplate;
|
EntityID m_BrickTemplate;
|
||||||
|
|
||||||
std::array<int, 42> m_Bricks;
|
std::array<int, 42> m_Bricks;
|
||||||
std::array<glm::vec4, 42> m_Colors;
|
std::array<glm::vec4, 42> m_Colors;
|
||||||
|
|
||||||
|
std::array<int, 14> m_BrickSet;
|
||||||
|
std::array<glm::vec4, 14> m_ColorSet;
|
||||||
|
|
||||||
dd::EventRelay<LevelSystem, dd::Events::Contact> m_EContact;
|
dd::EventRelay<LevelSystem, dd::Events::Contact> m_EContact;
|
||||||
dd::EventRelay<LevelSystem, dd::Events::ScoreEvent> m_EScoreEvent;
|
dd::EventRelay<LevelSystem, dd::Events::ScoreEvent> m_EScoreEvent;
|
||||||
dd::EventRelay<LevelSystem, dd::Events::MultiBall> m_EMultiBall;
|
dd::EventRelay<LevelSystem, dd::Events::MultiBall> m_EMultiBall;
|
||||||
@@ -158,8 +182,12 @@ private:
|
|||||||
dd::EventRelay<LevelSystem, dd::Events::CreatePowerUp> m_ECreatePowerUp;
|
dd::EventRelay<LevelSystem, dd::Events::CreatePowerUp> m_ECreatePowerUp;
|
||||||
dd::EventRelay<LevelSystem, dd::Events::PowerUpTaken> m_EPowerUpTaken;
|
dd::EventRelay<LevelSystem, dd::Events::PowerUpTaken> m_EPowerUpTaken;
|
||||||
dd::EventRelay<LevelSystem, dd::Events::StageCleared> m_EStageCleared;
|
dd::EventRelay<LevelSystem, dd::Events::StageCleared> m_EStageCleared;
|
||||||
|
dd::EventRelay<LevelSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage;
|
||||||
dd::EventRelay<LevelSystem, dd::Events::Pause> m_EPause;
|
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::HitPad> m_EHitPad;
|
||||||
|
dd::EventRelay<LevelSystem, dd::Events::BrickGenerating> m_EBrickGenerating;
|
||||||
|
dd::EventRelay<LevelSystem, dd::Events::KrakenDefeated> m_EKrakenDefeated;
|
||||||
|
|
||||||
bool OnContact(const dd::Events::Contact &event);
|
bool OnContact(const dd::Events::Contact &event);
|
||||||
bool OnScoreEvent(const dd::Events::ScoreEvent &event);
|
bool OnScoreEvent(const dd::Events::ScoreEvent &event);
|
||||||
@@ -168,8 +196,13 @@ private:
|
|||||||
bool OnCreatePowerUp(const dd::Events::CreatePowerUp &event);
|
bool OnCreatePowerUp(const dd::Events::CreatePowerUp &event);
|
||||||
bool OnPowerUpTaken(const dd::Events::PowerUpTaken &event);
|
bool OnPowerUpTaken(const dd::Events::PowerUpTaken &event);
|
||||||
bool OnStageCleared(const dd::Events::StageCleared &event);
|
bool OnStageCleared(const dd::Events::StageCleared &event);
|
||||||
|
bool OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event);
|
||||||
bool OnPause(const dd::Events::Pause &event);
|
bool OnPause(const dd::Events::Pause &event);
|
||||||
|
bool OnResume(const dd::Events::Resume &event);
|
||||||
bool OnHitPad(const dd::Events::HitPad &event);
|
bool OnHitPad(const dd::Events::HitPad &event);
|
||||||
|
bool OnBrickGenerating(const dd::Events::BrickGenerating &event);
|
||||||
|
void GetBrickSet(int Set);
|
||||||
|
bool OnKrakenDefeated(const dd::Events::KrakenDefeated &event);
|
||||||
|
|
||||||
void GetNextLevel();
|
void GetNextLevel();
|
||||||
void SetBrokenModel(EntityID entity);
|
void SetBrokenModel(EntityID entity);
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
#ifndef DAYDREAM_LIFEBUOYSYSTEM_H
|
#ifndef DAYDREAM_LIFEBUOYSYSTEM_H
|
||||||
#define DAYDREAM_LIFEBUOYSYSTEM_H
|
#define DAYDREAM_LIFEBUOYSYSTEM_H
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "Core/CTransform.h"
|
#include "Core/CTransform.h"
|
||||||
#include "Core/CTemplate.h"
|
#include "Core/CTemplate.h"
|
||||||
@@ -15,11 +17,11 @@
|
|||||||
#include "Physics/CPhysics.h"
|
#include "Physics/CPhysics.h"
|
||||||
#include "Physics/CRectangleShape.h"
|
#include "Physics/CRectangleShape.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
|
#include "Game/EResume.h"
|
||||||
#include "Game/ELifebuoy.h"
|
#include "Game/ELifebuoy.h"
|
||||||
#include "Game/ELifebuoyHit.h"
|
#include "Game/ELifebuoyHit.h"
|
||||||
#include "Game/CLifebuoy.h"
|
#include "Game/CLifebuoy.h"
|
||||||
#include <fstream>
|
#include "Physics/ECreateParticleSequence.h"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
{
|
{
|
||||||
@@ -48,11 +50,13 @@ private:
|
|||||||
|
|
||||||
dd::EventRelay<LifebuoySystem, dd::Events::Contact> m_EContact;
|
dd::EventRelay<LifebuoySystem, dd::Events::Contact> m_EContact;
|
||||||
dd::EventRelay<LifebuoySystem, dd::Events::Pause> m_EPause;
|
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::Lifebuoy> m_ELifebuoy;
|
||||||
dd::EventRelay<LifebuoySystem, dd::Events::LifebuoyHit> m_ELifebuoyHit;
|
dd::EventRelay<LifebuoySystem, dd::Events::LifebuoyHit> m_ELifebuoyHit;
|
||||||
|
|
||||||
bool OnContact(const dd::Events::Contact &event);
|
bool OnContact(const dd::Events::Contact &event);
|
||||||
bool OnPause(const dd::Events::Pause &event);
|
bool OnPause(const dd::Events::Pause &event);
|
||||||
|
bool OnResume(const dd::Events::Resume &event);
|
||||||
bool OnLifebuoy(const dd::Events::Lifebuoy &event);
|
bool OnLifebuoy(const dd::Events::Lifebuoy &event);
|
||||||
bool OnLifebuoyHit(const dd::Events::LifebuoyHit &event);
|
bool OnLifebuoyHit(const dd::Events::LifebuoyHit &event);
|
||||||
|
|
||||||
|
|||||||
@@ -13,20 +13,32 @@
|
|||||||
#include "Core/EventBroker.h"
|
#include "Core/EventBroker.h"
|
||||||
#include "Core/EKeyDown.h"
|
#include "Core/EKeyDown.h"
|
||||||
#include "Core/EKeyUp.h"
|
#include "Core/EKeyUp.h"
|
||||||
|
|
||||||
#include "Input/EBindKey.h"
|
#include "Input/EBindKey.h"
|
||||||
|
|
||||||
#include "Physics/EContact.h"
|
#include "Physics/EContact.h"
|
||||||
#include "Physics/CRectangleShape.h"
|
#include "Physics/CRectangleShape.h"
|
||||||
|
#include "Physics/CWaterVolume.h"
|
||||||
#include "Physics/CPhysics.h"
|
#include "Physics/CPhysics.h"
|
||||||
#include "Physics/CCircleShape.h"
|
#include "Physics/CCircleShape.h"
|
||||||
#include "Physics/ESetImpulse.h"
|
#include "Physics/ESetImpulse.h"
|
||||||
|
|
||||||
#include "Rendering/CSprite.h"
|
#include "Rendering/CSprite.h"
|
||||||
#include "Rendering/CModel.h"
|
#include "Rendering/CModel.h"
|
||||||
|
|
||||||
|
#include "Transform/EMove.h"
|
||||||
|
#include "Transform/ERotate.h"
|
||||||
|
|
||||||
#include "Game/CBall.h"
|
#include "Game/CBall.h"
|
||||||
#include "Game/CPad.h"
|
#include "Game/CPad.h"
|
||||||
#include "Game/CPowerUp.h"
|
#include "Game/CPowerUp.h"
|
||||||
#include "Game/CStickyAim.h"
|
#include "Game/CStickyAim.h"
|
||||||
#include "Game/EResetBall.h"
|
#include "Game/EResetBall.h"
|
||||||
|
#include "Game/EResetAll.h"
|
||||||
|
#include "Game/ERaiseWater.h"
|
||||||
|
#include "Game/ERaiseWaterWall.h"
|
||||||
#include "Game/EMultiBall.h"
|
#include "Game/EMultiBall.h"
|
||||||
|
#include "Game/ELifebuoy.h"
|
||||||
#include "Game/EStickyPad.h"
|
#include "Game/EStickyPad.h"
|
||||||
#include "Game/EStickyAttachedToPad.h"
|
#include "Game/EStickyAttachedToPad.h"
|
||||||
#include "Game/EInkBlaster.h"
|
#include "Game/EInkBlaster.h"
|
||||||
@@ -34,10 +46,13 @@
|
|||||||
#include "Game/EPowerUpTaken.h"
|
#include "Game/EPowerUpTaken.h"
|
||||||
#include "Game/EStageCleared.h"
|
#include "Game/EStageCleared.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
|
#include "Game/EResume.h"
|
||||||
#include "Game/EHitLag.h"
|
#include "Game/EHitLag.h"
|
||||||
#include "Game/EScreenShake.h"
|
#include "Game/EScreenShake.h"
|
||||||
#include "Game/EActionButton.h"
|
#include "Game/EActionButton.h"
|
||||||
|
|
||||||
|
#include "Game/EBrickGenerating.h"
|
||||||
|
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
{
|
{
|
||||||
@@ -102,7 +117,11 @@ private:
|
|||||||
dd::EventRelay<PadSystem, dd::Events::Contact> m_EContactPowerUp;
|
dd::EventRelay<PadSystem, dd::Events::Contact> m_EContactPowerUp;
|
||||||
dd::EventRelay<PadSystem, dd::Events::StageCleared> m_EStageCleared;
|
dd::EventRelay<PadSystem, dd::Events::StageCleared> m_EStageCleared;
|
||||||
dd::EventRelay<PadSystem, dd::Events::ResetBall> m_EResetBall;
|
dd::EventRelay<PadSystem, dd::Events::ResetBall> m_EResetBall;
|
||||||
|
dd::EventRelay<PadSystem, dd::Events::ResetAll> m_EResetAll;
|
||||||
|
dd::EventRelay<PadSystem, dd::Events::RaiseWater> m_ERaiseWater;
|
||||||
|
dd::EventRelay<PadSystem, dd::Events::RaiseWaterWall> m_ERaiseWaterWall;
|
||||||
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::KrakenAttack> m_EKrakenAttack;
|
dd::EventRelay<PadSystem, dd::Events::KrakenAttack> m_EKrakenAttack;
|
||||||
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;
|
||||||
@@ -114,7 +133,12 @@ private:
|
|||||||
bool OnContactPowerUp(const dd::Events::Contact &event);
|
bool OnContactPowerUp(const dd::Events::Contact &event);
|
||||||
bool OnStageCleared(const dd::Events::StageCleared &event);
|
bool OnStageCleared(const dd::Events::StageCleared &event);
|
||||||
bool OnResetBall(const dd::Events::ResetBall &event);
|
bool OnResetBall(const dd::Events::ResetBall &event);
|
||||||
|
bool OnResetAll(const dd::Events::ResetAll &event);
|
||||||
|
bool OnRaiseWater(const dd::Events::RaiseWater &event);
|
||||||
|
bool OnRaiseWaterWall(const dd::Events::RaiseWaterWall &event);
|
||||||
|
bool RaisePad(float amount, float speed);
|
||||||
bool OnPause(const dd::Events::Pause &event);
|
bool OnPause(const dd::Events::Pause &event);
|
||||||
|
bool OnResume(const dd::Events::Resume &event);
|
||||||
bool OnKrakenAttack(const dd::Events::KrakenAttack &event);
|
bool OnKrakenAttack(const dd::Events::KrakenAttack &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);
|
||||||
|
|||||||
@@ -16,12 +16,14 @@
|
|||||||
#include "Physics/CPhysics.h"
|
#include "Physics/CPhysics.h"
|
||||||
#include "Physics/CCircleShape.h"
|
#include "Physics/CCircleShape.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
|
#include "Game/EResume.h"
|
||||||
#include "Game/EInkBlaster.h"
|
#include "Game/EInkBlaster.h"
|
||||||
#include "Game/EInkBlasterOver.h"
|
#include "Game/EInkBlasterOver.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"
|
||||||
#include "Game/CBall.h"
|
#include "Game/CBall.h"
|
||||||
|
#include "Rendering/CSprite.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@@ -51,17 +53,20 @@ private:
|
|||||||
bool m_InkBlaster = false;
|
bool m_InkBlaster = false;
|
||||||
bool m_SquidLoaded = false;
|
bool m_SquidLoaded = false;
|
||||||
int m_Shots = 0;
|
int m_Shots = 0;
|
||||||
|
float m_InkBlasterSpeed = 5;
|
||||||
EntityID m_InkBlastTemplate;
|
EntityID m_InkBlastTemplate;
|
||||||
EntityID m_AttachedSquid;
|
EntityID m_AttachedSquid;
|
||||||
|
|
||||||
dd::EventRelay<ProjectileSystem, dd::Events::Contact> m_EContact;
|
dd::EventRelay<ProjectileSystem, dd::Events::Contact> m_EContact;
|
||||||
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::InkBlaster> m_EInkBlaster;
|
dd::EventRelay<ProjectileSystem, dd::Events::InkBlaster> m_EInkBlaster;
|
||||||
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;
|
||||||
|
|
||||||
bool OnContact(const dd::Events::Contact &event);
|
bool OnContact(const dd::Events::Contact &event);
|
||||||
bool OnPause(const dd::Events::Pause &event);
|
bool OnPause(const dd::Events::Pause &event);
|
||||||
|
bool OnResume(const dd::Events::Resume &event);
|
||||||
bool OnInkBlaster(const dd::Events::InkBlaster &event);
|
bool OnInkBlaster(const dd::Events::InkBlaster &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);
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-14.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_SCREENSHAKESYSTEM_H
|
||||||
|
#define DAYDREAM_SCREENSHAKESYSTEM_H
|
||||||
|
|
||||||
|
#include <random>
|
||||||
|
|
||||||
|
#include "Core/System.h"
|
||||||
|
#include "Core/CTransform.h"
|
||||||
|
#include "Core/CTemplate.h"
|
||||||
|
#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
|
||||||
|
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Systems
|
||||||
|
{
|
||||||
|
|
||||||
|
class ScreenShakeSystem : public System
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScreenShakeSystem(World* world, std::shared_ptr<dd::EventBroker> eventBroker)
|
||||||
|
: System(world, eventBroker)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
void Initialize() override;
|
||||||
|
void InitializeObjects();
|
||||||
|
|
||||||
|
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
|
||||||
|
void FlipPause();
|
||||||
|
|
||||||
|
bool IsPaused() const { return m_Pause; }
|
||||||
|
void SetPause(const bool& pause) { m_Pause = pause; }
|
||||||
|
private:
|
||||||
|
std::mt19937 m_RandomGenerator;
|
||||||
|
|
||||||
|
bool m_Pause;
|
||||||
|
bool m_ScreenShake;
|
||||||
|
int m_ShakeIntensity;
|
||||||
|
glm::vec3 m_CameraPosition;
|
||||||
|
float m_ShakeRepresentativeIntensity;
|
||||||
|
float m_ShakeTimer;
|
||||||
|
float m_ShakeEndTime;
|
||||||
|
float m_TimeTakenToCoolDown;
|
||||||
|
float m_CoolerMultiplier;
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_SCREENSHAKESYSTEM_H
|
||||||
@@ -8,11 +8,16 @@
|
|||||||
|
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "Core/CTransform.h"
|
#include "Core/CTransform.h"
|
||||||
|
#include "Core/CTemplate.h"
|
||||||
#include "Core/EventBroker.h"
|
#include "Core/EventBroker.h"
|
||||||
#include "Core/World.h"
|
#include "Core/World.h"
|
||||||
|
#include "Transform/EMove.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
|
#include "Game/EResume.h"
|
||||||
#include "Game/EArrivedAtNewStage.h"
|
#include "Game/EArrivedAtNewStage.h"
|
||||||
#include "Game/EStageCleared.h"
|
#include "Game/EStageCleared.h"
|
||||||
|
#include "Game/CTravels.h"
|
||||||
|
#include "Game/CBackground.h"
|
||||||
|
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
@@ -43,10 +48,14 @@ private:
|
|||||||
float m_DistanceTravelled = 0;
|
float m_DistanceTravelled = 0;
|
||||||
|
|
||||||
dd::EventRelay<TravellingSystem, dd::Events::Pause> m_EPause;
|
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::StageCleared> m_EStageCleared;
|
||||||
|
dd::EventRelay<TravellingSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage;
|
||||||
|
|
||||||
bool OnPause(const dd::Events::Pause &event);
|
bool OnPause(const dd::Events::Pause &event);
|
||||||
|
bool OnResume(const dd::Events::Resume &event);
|
||||||
bool OnStageCleared(const dd::Events::StageCleared &event);
|
bool OnStageCleared(const dd::Events::StageCleared &event);
|
||||||
|
bool OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_WATERSYSTEM_H
|
||||||
|
#define DAYDREAM_WATERSYSTEM_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "Core/System.h"
|
||||||
|
#include "Core/CTransform.h"
|
||||||
|
#include "Core/CTemplate.h"
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
#include "Core/World.h"
|
||||||
|
#include "Transform/EMove.h"
|
||||||
|
#include "Physics/CWaterVolume.h"
|
||||||
|
#include "Physics/CRectangleShape.h"
|
||||||
|
#include "Game/EPause.h"
|
||||||
|
#include "Game/EResume.h"
|
||||||
|
#include "Game/ERelevantObjectCreated.h"
|
||||||
|
#include "Game/ERaiseWater.h"
|
||||||
|
#include "Game/ERaiseWaterWall.h"
|
||||||
|
#include "Game/EArrivedAtNewStage.h"
|
||||||
|
#include "Game/EStageCleared.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Systems
|
||||||
|
{
|
||||||
|
|
||||||
|
class WaterSystem : public System
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WaterSystem(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; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_Pause = false;
|
||||||
|
EntityID m_BottomWall = 0;
|
||||||
|
|
||||||
|
dd::EventRelay<WaterSystem, dd::Events::Pause> m_EPause;
|
||||||
|
dd::EventRelay<WaterSystem, dd::Events::Resume> m_EResume;
|
||||||
|
dd::EventRelay<WaterSystem, dd::Events::RelevantObjectCreated> m_ERelevantObjectCreated;
|
||||||
|
dd::EventRelay<WaterSystem, dd::Events::StageCleared> m_EStageCleared;
|
||||||
|
dd::EventRelay<WaterSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage;
|
||||||
|
dd::EventRelay<WaterSystem, dd::Events::RaiseWater> m_ERaiseWater;
|
||||||
|
dd::EventRelay<WaterSystem, dd::Events::RaiseWaterWall> m_ERaiseWaterWall;
|
||||||
|
|
||||||
|
bool OnPause(const dd::Events::Pause &event);
|
||||||
|
bool OnResume(const dd::Events::Resume &event);
|
||||||
|
bool OnRelevantObjectCreated(const dd::Events::RelevantObjectCreated &event);
|
||||||
|
bool OnStageCleared(const dd::Events::StageCleared &event);
|
||||||
|
bool OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event);
|
||||||
|
bool OnRaiseWater(const dd::Events::RaiseWater &event);
|
||||||
|
bool OnRaiseWaterWall(const dd::Events::RaiseWaterWall &event);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_WATERSYSTEM_H
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#include <Box2D/Box2D.h>
|
#include <Box2D/Box2D.h>
|
||||||
|
|
||||||
|
#include "Core/ResourceManager.h"
|
||||||
|
#include "Core/ConfigFile.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "Core/World.h"
|
#include "Core/World.h"
|
||||||
#include "Core/EventBroker.h"
|
#include "Core/EventBroker.h"
|
||||||
@@ -32,6 +34,7 @@
|
|||||||
|
|
||||||
#include "CRectangleShape.h"
|
#include "CRectangleShape.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
|
#include "Game/EResume.h"
|
||||||
#include "Game/CPad.h"
|
#include "Game/CPad.h"
|
||||||
#include "Game/CBrick.h"
|
#include "Game/CBrick.h"
|
||||||
#include "Game/CBall.h"
|
#include "Game/CBall.h"
|
||||||
@@ -114,6 +117,8 @@ namespace dd
|
|||||||
bool SetImpulse(const Events::SetImpulse &event);
|
bool SetImpulse(const Events::SetImpulse &event);
|
||||||
dd::EventRelay<PhysicsSystem, dd::Events::Pause> m_EPause;
|
dd::EventRelay<PhysicsSystem, dd::Events::Pause> m_EPause;
|
||||||
bool OnPause(const dd::Events::Pause &event);
|
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;
|
dd::EventRelay<PhysicsSystem, dd::Events::Contact> m_EContact;
|
||||||
bool OnContact(const dd::Events::Contact &event);
|
bool OnContact(const dd::Events::Contact &event);
|
||||||
EventRelay<PhysicsSystem, Events::CreateParticleSequence> m_ECreateParticleSequence;
|
EventRelay<PhysicsSystem, Events::CreateParticleSequence> m_ECreateParticleSequence;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "Core/World.h"
|
#include "Core/World.h"
|
||||||
#include "Rendering/CAnimation.h"
|
#include "Rendering/CAnimation.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
|
#include "Game/EResume.h"
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
{
|
{
|
||||||
@@ -25,7 +26,9 @@ private:
|
|||||||
bool m_Paused = false;
|
bool m_Paused = false;
|
||||||
|
|
||||||
EventRelay<AnimationSystem, Events::Pause> m_EPause;
|
EventRelay<AnimationSystem, Events::Pause> m_EPause;
|
||||||
|
EventRelay<AnimationSystem, Events::Resume> m_EResume;
|
||||||
bool OnPause(const Events::Pause& e);
|
bool OnPause(const Events::Pause& e);
|
||||||
|
bool OnResume(const Events::Resume& e);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
#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/ResourceManager.h"
|
||||||
|
#include "Core/ConfigFile.h"
|
||||||
#include "Game/EScreenShake.h"
|
#include "Game/EScreenShake.h"
|
||||||
#include "Rendering/Model.h"
|
#include "Rendering/Model.h"
|
||||||
#include "Rendering/Texture.h"
|
#include "Rendering/Texture.h"
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class Sound : public Resource
|
|||||||
friend class ResourceManager;
|
friend class ResourceManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
~Sound();
|
||||||
ALuint Buffer() { return m_Buffer; };
|
ALuint Buffer() { return m_Buffer; };
|
||||||
std::string Path() { return m_Path; };
|
std::string Path() { return m_Path; };
|
||||||
float Gain() { return m_Gain; };
|
float Gain() { return m_Gain; };
|
||||||
|
|||||||
@@ -10,15 +10,17 @@
|
|||||||
#include "Core/ResourceManager.h"
|
#include "Core/ResourceManager.h"
|
||||||
#include "Core/ConfigFile.h"
|
#include "Core/ConfigFile.h"
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
#include "Sound/EPlaySound.h"
|
|
||||||
#include "Sound/EStopSound.h"
|
|
||||||
#include "Sound/EMasterVolume.h"
|
|
||||||
#include "Sound/CCollisionSound.h"
|
#include "Sound/CCollisionSound.h"
|
||||||
#include "Physics/EContact.h"
|
|
||||||
#include "Game/CBall.h"
|
#include "Game/CBall.h"
|
||||||
#include "Game/CBrick.h"
|
#include "Game/CBrick.h"
|
||||||
#include "Game/CPad.h"
|
#include "Game/CPad.h"
|
||||||
|
#include "Sound/EPlaySound.h"
|
||||||
|
#include "Sound/EStopSound.h"
|
||||||
|
#include "Sound/EMasterVolume.h"
|
||||||
#include "Physics/ECreateParticleSequence.h"
|
#include "Physics/ECreateParticleSequence.h"
|
||||||
|
#include "Physics/EContact.h"
|
||||||
|
#include "Game/EGameStart.h"
|
||||||
|
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
{
|
{
|
||||||
@@ -36,11 +38,16 @@ public:
|
|||||||
void Update(double dt) override;
|
void Update(double dt) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const std::string MENU_BGM = "Sounds/BGM/eastern-music.wav";
|
||||||
|
const std::string GAME_BGM = "Sounds/BGM/under-the-sea-n.wav";
|
||||||
|
const std::string WATER_BGM = "Sounds/BGM/water-flowing.wav";
|
||||||
|
|
||||||
float m_BGMMasterVolume = 1.f;
|
float m_BGMMasterVolume = 1.f;
|
||||||
float m_SFXMasterVolume = 1.f;
|
float m_SFXMasterVolume = 1.f;
|
||||||
std::map<ALuint, Sound*> m_BGMSourcesToBuffers;
|
std::map<ALuint, Sound*> m_BGMSourcesToBuffers;
|
||||||
std::map<ALuint, Sound*> m_SFXSourcesToBuffers;
|
std::map<ALuint, Sound*> m_SFXSourcesToBuffers;
|
||||||
ALCdevice* m_Device = nullptr;
|
ALCdevice* m_Device = nullptr;
|
||||||
|
ALCcontext* m_Context = nullptr;
|
||||||
|
|
||||||
//Events
|
//Events
|
||||||
dd::EventRelay<SoundSystem, dd::Events::PlaySound> m_EPlaySFX;
|
dd::EventRelay<SoundSystem, dd::Events::PlaySound> m_EPlaySFX;
|
||||||
@@ -52,6 +59,9 @@ private:
|
|||||||
bool OnStopSound(const dd::Events::StopSound &event);
|
bool OnStopSound(const dd::Events::StopSound &event);
|
||||||
dd::EventRelay<SoundSystem, dd::Events::MasterVolume> m_EMasterVolume;
|
dd::EventRelay<SoundSystem, dd::Events::MasterVolume> m_EMasterVolume;
|
||||||
bool OnMasterVolume(const dd::Events::MasterVolume &event);
|
bool OnMasterVolume(const dd::Events::MasterVolume &event);
|
||||||
|
dd::EventRelay<SoundSystem, dd::Events::GameStart> m_EGameStart;
|
||||||
|
bool OnGameStart(const dd::Events::GameStart &event);
|
||||||
|
|
||||||
|
|
||||||
ALuint CreateSource();
|
ALuint CreateSource();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,14 +39,38 @@ public:
|
|||||||
TransformSystem(World* world, std::shared_ptr<dd::EventBroker> eventBroker)
|
TransformSystem(World* world, std::shared_ptr<dd::EventBroker> eventBroker)
|
||||||
: System(world, eventBroker)
|
: System(world, eventBroker)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
void Initialize() override;
|
||||||
void Update(double dt) override;
|
void Update(double dt) override;
|
||||||
|
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
|
||||||
|
|
||||||
Components::Transform AbsoluteTransform(EntityID entity);
|
Components::Transform AbsoluteTransform(EntityID entity);
|
||||||
glm::vec3 AbsolutePosition(EntityID entity);
|
glm::vec3 AbsolutePosition(EntityID entity);
|
||||||
glm::quat AbsoluteOrientation(EntityID entity);
|
glm::quat AbsoluteOrientation(EntityID entity);
|
||||||
glm::vec3 AbsoluteScale(EntityID entity);
|
glm::vec3 AbsoluteScale(EntityID entity);
|
||||||
|
|
||||||
|
// Events
|
||||||
|
EventRelay<TransformSystem, Events::Move> m_EMove;
|
||||||
|
bool OnMove(const Events::Move &event);
|
||||||
|
EventRelay<TransformSystem, Events::Rotate> m_ERotate;
|
||||||
|
bool OnRotate(const Events::Rotate &event);
|
||||||
private:
|
private:
|
||||||
|
struct MoveItems
|
||||||
|
{
|
||||||
|
EntityID Entity;
|
||||||
|
glm::vec3 GoalPosition;
|
||||||
|
float Speed;
|
||||||
|
};
|
||||||
|
std::unordered_map<EntityID, MoveItems> m_MoveItems;
|
||||||
|
std::multimap<EntityID, MoveItems> m_QueuedMoveItems;
|
||||||
|
struct RotationItems
|
||||||
|
{
|
||||||
|
EntityID Entity;
|
||||||
|
glm::quat GoalRotation;
|
||||||
|
double Time;
|
||||||
|
};
|
||||||
|
std::unordered_map<EntityID, RotationItems> m_RotationItems;
|
||||||
|
std::multimap<EntityID, RotationItems> m_QueuedRotationItems;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ void dd::Systems::BallSystem::Initialize()
|
|||||||
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_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_EActionButton, &BallSystem::OnActionButton);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &BallSystem::OnStageCleared);
|
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &BallSystem::OnStageCleared);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EArrivedAtNewStage, &BallSystem::OnArrivedToNewStage);
|
EVENT_SUBSCRIBE_MEMBER(m_EArrivedAtNewStage, &BallSystem::OnArrivedToNewStage);
|
||||||
@@ -31,7 +32,7 @@ void dd::Systems::BallSystem::Initialize()
|
|||||||
{
|
{
|
||||||
auto ent = m_World->CreateEntity();
|
auto ent = m_World->CreateEntity();
|
||||||
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(ent);
|
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(ent);
|
||||||
transform->Position = glm::vec3(0.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);
|
||||||
auto model = m_World->AddComponent<Components::Model>(ent);
|
auto model = m_World->AddComponent<Components::Model>(ent);
|
||||||
@@ -49,7 +50,6 @@ void dd::Systems::BallSystem::Initialize()
|
|||||||
physics->Category = CollisionLayer::Type::Ball;
|
physics->Category = CollisionLayer::Type::Ball;
|
||||||
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Type::Pad | CollisionLayer::Type::Brick | CollisionLayer::Type::Wall | CollisionLayer::LifeBuoy);
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Type::Pad | CollisionLayer::Type::Brick | CollisionLayer::Type::Wall | CollisionLayer::LifeBuoy);
|
||||||
physics->Calculate = true;
|
physics->Calculate = true;
|
||||||
transform->Sticky = true;
|
|
||||||
|
|
||||||
m_World->CommitEntity(ent);
|
m_World->CommitEntity(ent);
|
||||||
|
|
||||||
@@ -64,6 +64,8 @@ void dd::Systems::BallSystem::Initialize()
|
|||||||
for (int i = 0; i < Lives(); i++) {
|
for (int i = 0; i < Lives(); i++) {
|
||||||
CreateLife(i);
|
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)
|
||||||
@@ -87,8 +89,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?
|
//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);
|
auto ballComponent = m_World->GetComponent<Components::Ball>(entity);
|
||||||
if (IsPaused()) {
|
|
||||||
|
/*if (IsPaused()) {
|
||||||
if (ballComponent != nullptr) {
|
if (ballComponent != nullptr) {
|
||||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
|
|
||||||
@@ -108,7 +115,7 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
ballComponent->Paused = false;
|
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; }
|
||||||
@@ -170,7 +177,7 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} //Removing this made the wall collisions work again
|
} //Removing this made the wall collisions work again
|
||||||
/*else if (transformBall->Position.x > EdgeX()) {
|
/* else if (transformBall->Position.x > EdgeX()) {
|
||||||
if (transformBall->Velocity.x > 0) {
|
if (transformBall->Velocity.x > 0) {
|
||||||
glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(1, 0));
|
glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(1, 0));
|
||||||
transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f);
|
transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f);
|
||||||
@@ -180,7 +187,7 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(-1, 0));
|
glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(-1, 0));
|
||||||
transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f);
|
transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f);
|
||||||
}
|
}
|
||||||
} else if (transformBall->Position.y > EdgeY()) {
|
} /*else if (transformBall->Position.y > EdgeY()) {
|
||||||
if (transformBall->Velocity.y > 0) {
|
if (transformBall->Velocity.y > 0) {
|
||||||
glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(0, 1));
|
glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(0, 1));
|
||||||
transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f);
|
transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f);
|
||||||
@@ -212,18 +219,26 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
|
|
||||||
bool dd::Systems::BallSystem::OnPause(const dd::Events::Pause &event)
|
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;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
m_Pause = true;
|
||||||
|
|
||||||
if (IsPaused()) {
|
|
||||||
SetPause(false);
|
|
||||||
} else {
|
|
||||||
SetPause(true);
|
|
||||||
}
|
|
||||||
return 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)
|
void dd::Systems::BallSystem::OnEntityCommit(EntityID entity)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -269,6 +284,10 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ballComponent->Waiting || ballComponent->Sticky) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
auto ballTransform = m_World->GetComponent<Components::Transform>(ballEntity);
|
auto ballTransform = m_World->GetComponent<Components::Transform>(ballEntity);
|
||||||
glm::vec2 ballVelocity = glm::vec2(ballTransform->Velocity.x, ballTransform->Velocity.y);
|
glm::vec2 ballVelocity = glm::vec2(ballTransform->Velocity.x, ballTransform->Velocity.y);
|
||||||
@@ -321,9 +340,6 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event)
|
|||||||
EventBroker->Publish(particleEvent);
|
EventBroker->Publish(particleEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ballComponent->Combo = 0;
|
ballComponent->Combo = 0;
|
||||||
if (!ballComponent->Waiting) {
|
if (!ballComponent->Waiting) {
|
||||||
if (m_InkBlaster) {
|
if (m_InkBlaster) {
|
||||||
@@ -341,7 +357,8 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event)
|
|||||||
m_Sticky = false;
|
m_Sticky = false;
|
||||||
m_Waiting = true;
|
m_Waiting = true;
|
||||||
ballComponent->Sticky = true;
|
ballComponent->Sticky = true;
|
||||||
ballComponent->StickyPlacement = ballTransform->Position - padTransform->Position;
|
//ballComponent->StickyPlacement = ballTransform->Position - padTransform->Position;
|
||||||
|
ballComponent->StickyPlacement = glm::vec3(0, 0.5f, 0);
|
||||||
ballComponent->SavedSpeed = glm::normalize(glm::vec3(x, y, 0.f)) * ballComponent->Speed;
|
ballComponent->SavedSpeed = glm::normalize(glm::vec3(x, y, 0.f)) * ballComponent->Speed;
|
||||||
ballTransform->Velocity *= -1;
|
ballTransform->Velocity *= -1;
|
||||||
Events::StickyAttachedToPad e;
|
Events::StickyAttachedToPad e;
|
||||||
@@ -417,7 +434,6 @@ void dd::Systems::BallSystem::CreateLife(int number)
|
|||||||
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(life);
|
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->Position = glm::vec3(-1.5f + number * 0.15f, -2.f, -5.f);
|
||||||
transform->Scale = glm::vec3(0.1f, 0.1f, 0.1f);
|
transform->Scale = glm::vec3(0.1f, 0.1f, 0.1f);
|
||||||
transform->Sticky = true;
|
|
||||||
|
|
||||||
std::shared_ptr<Components::Life> lifeNr = m_World->AddComponent<Components::Life>(life);
|
std::shared_ptr<Components::Life> lifeNr = m_World->AddComponent<Components::Life>(life);
|
||||||
lifeNr->Number = number;
|
lifeNr->Number = number;
|
||||||
@@ -431,8 +447,9 @@ void dd::Systems::BallSystem::CreateLife(int number)
|
|||||||
|
|
||||||
bool dd::Systems::BallSystem::OnLifeLost(const dd::Events::LifeLost &event)
|
bool dd::Systems::BallSystem::OnLifeLost(const dd::Events::LifeLost &event)
|
||||||
{
|
{
|
||||||
SetLives(Lives() - 1);
|
if (!m_GodMode){
|
||||||
|
SetLives(Lives() - 1);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,6 +502,7 @@ bool dd::Systems::BallSystem::OnMultiBall(const dd::Events::MultiBall &event)
|
|||||||
bool dd::Systems::BallSystem::OnStickyPad(const dd::Events::StickyPad &event)
|
bool dd::Systems::BallSystem::OnStickyPad(const dd::Events::StickyPad &event)
|
||||||
{
|
{
|
||||||
m_Sticky = true;
|
m_Sticky = true;
|
||||||
|
m_StickyCounter = event.Times;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
void dd::Systems::HitLagSystem::Initialize()
|
void dd::Systems::HitLagSystem::Initialize()
|
||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &HitLagSystem::OnPause);
|
EVENT_SUBSCRIBE_MEMBER(m_EPause, &HitLagSystem::OnPause);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EResume, &HitLagSystem::OnResume);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EHitLag, &HitLagSystem::OnHitLag);
|
EVENT_SUBSCRIBE_MEMBER(m_EHitLag, &HitLagSystem::OnHitLag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,25 +30,33 @@ void dd::Systems::HitLagSystem::Update(double dt)
|
|||||||
|
|
||||||
void dd::Systems::HitLagSystem::FlipPause()
|
void dd::Systems::HitLagSystem::FlipPause()
|
||||||
{
|
{
|
||||||
Events::Pause e;
|
if (!IsPaused()) {
|
||||||
e.Type = CurrentType();
|
Events::Pause e;
|
||||||
EventBroker->Publish(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)
|
bool dd::Systems::HitLagSystem::OnPause(const dd::Events::Pause &event)
|
||||||
{
|
{
|
||||||
if (IsPaused()) {
|
m_Pause = true;
|
||||||
SetPause(false);
|
|
||||||
} else {
|
|
||||||
SetPause(true);
|
|
||||||
}
|
|
||||||
return 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)
|
bool dd::Systems::HitLagSystem::OnHitLag(const dd::Events::HitLag &event)
|
||||||
{
|
{
|
||||||
if (HitLag()) {
|
if (HitLag()) {
|
||||||
FlipPause();
|
FlipPause();
|
||||||
|
SetHitLagTimer(0);
|
||||||
}
|
}
|
||||||
SetHitLag(true);
|
SetHitLag(true);
|
||||||
SetCurrentType(event.Type);
|
SetCurrentType(event.Type);
|
||||||
|
|||||||
@@ -0,0 +1,291 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-15.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "PrecompiledHeader.h"
|
||||||
|
#include "Game/KrakenSystem.h"
|
||||||
|
|
||||||
|
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_EContact, &KrakenSystem::OnContact);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAppear, &KrakenSystem::OnKrakenAppear);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &KrakenSystem::OnKrakenAttack);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EKrakenHit, &KrakenSystem::OnKrakenHit);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EKrakenDefeated, &KrakenSystem::OnKrakenDefeated);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EBrickGenerating, &KrakenSystem::OnBrickGenerating);
|
||||||
|
|
||||||
|
EntityID ent = m_World->CreateEntity();
|
||||||
|
auto transform = m_World->AddComponent<Components::Transform>(ent);
|
||||||
|
auto model = m_World->AddComponent<Components::Model>(ent);
|
||||||
|
auto kraken = m_World->AddComponent<Components::Kraken>(ent);
|
||||||
|
std::shared_ptr<Components::RectangleShape> cCircle = m_World->AddComponent<Components::RectangleShape>(ent);
|
||||||
|
cCircle->Dimensions = glm::vec2(2, 4);
|
||||||
|
//cCircle->Radius = 2;
|
||||||
|
std::shared_ptr<Components::Physics> cPhys = m_World->AddComponent<Components::Physics>(ent);
|
||||||
|
std::shared_ptr<Components::Template> cTemplate = m_World->AddComponent<Components::Template>(ent);
|
||||||
|
|
||||||
|
auto travels = m_World->AddComponent<Components::Travels>(ent);
|
||||||
|
travels->CurrentlyTraveling = false;
|
||||||
|
|
||||||
|
cPhys->CollisionType = CollisionType::Type::Static;
|
||||||
|
cPhys->GravityScale = 0.f;
|
||||||
|
cPhys->Category = CollisionLayer::Type::Brick;
|
||||||
|
cPhys->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Type::Ball | CollisionLayer::Type::Projectile | CollisionLayer::Type::Wall | CollisionLayer::LifeBuoy);
|
||||||
|
|
||||||
|
model->ModelFile = "Models/Test/Ball/Sid.obj";
|
||||||
|
transform->Position = glm::vec3(50, 50, -10);
|
||||||
|
//sound
|
||||||
|
auto collisionSound = m_World->AddComponent<Components::CollisionSound>(ent);
|
||||||
|
collisionSound->FilePath = "Sounds/Brick/LTTP_Boss_Hit.wav";
|
||||||
|
m_World->CommitEntity(ent);
|
||||||
|
|
||||||
|
m_KrakenTemplate = ent;
|
||||||
|
|
||||||
|
InitializeObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
if (IsPaused() || !m_KrakenBattle) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
||||||
|
if (templateCheck != nullptr){ return; }
|
||||||
|
|
||||||
|
auto kraken = m_World->GetComponent<Components::Kraken>(entity);
|
||||||
|
if (kraken != nullptr) {
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
|
if (transform->Position.y < -10) {
|
||||||
|
m_World->RemoveEntity(entity);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Events::KrakenAttack krakenAttack;
|
||||||
|
switch (kraken->CurrentAction)
|
||||||
|
{
|
||||||
|
case 1: // Idle
|
||||||
|
//m_KrakenTimer += dt;
|
||||||
|
if (m_KrakenTimer > m_KrakenSecondsToAction) {
|
||||||
|
m_KrakenTimer = 0;
|
||||||
|
std::uniform_real_distribution<float> dist(1, 2.999f);
|
||||||
|
float random = dist(m_RandomGenerator);
|
||||||
|
//std::cout << random << std::endl;
|
||||||
|
kraken->CurrentAction = random;
|
||||||
|
//std::cout << kraken->CurrentAction << std::endl;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2: // Grabbing
|
||||||
|
kraken->CurrentAction = 5;
|
||||||
|
krakenAttack.ChargeUpdate = 0;
|
||||||
|
krakenAttack.KrakenStrength = 0.1;
|
||||||
|
krakenAttack.PlayerStrength = 0.05;
|
||||||
|
EventBroker->Publish(krakenAttack);
|
||||||
|
break;
|
||||||
|
case 3: // Brick Generating
|
||||||
|
break;
|
||||||
|
case 4: // Moving
|
||||||
|
break;
|
||||||
|
case 5: // Taunting
|
||||||
|
if (m_ReturnToIdle) {
|
||||||
|
m_ReturnToIdle = false;
|
||||||
|
kraken->CurrentAction = Idle;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//LOG_INFO("Something's probably off about the random number generator.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::KrakenSystem::OnPause(const dd::Events::Pause &event)
|
||||||
|
{
|
||||||
|
/*if (event.Type != "KrakenSystem" && event.Type != "All") {
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
m_Pause = 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::OnContact(const dd::Events::Contact &event)
|
||||||
|
{
|
||||||
|
Components::Kraken* kraken1 = m_World->GetComponent<Components::Kraken>(event.Entity1);
|
||||||
|
Components::Kraken* kraken2 = m_World->GetComponent<Components::Kraken>(event.Entity2);
|
||||||
|
Components::Kraken* kraken;
|
||||||
|
|
||||||
|
if (kraken1 != nullptr && kraken2 != nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityID krakenEntity, otherEntitiy;
|
||||||
|
|
||||||
|
//Which is the ball?
|
||||||
|
if (kraken1 != nullptr) {
|
||||||
|
krakenEntity = event.Entity1;
|
||||||
|
otherEntitiy = event.Entity2;
|
||||||
|
kraken = kraken1;
|
||||||
|
}
|
||||||
|
else if (kraken2 != nullptr) {
|
||||||
|
krakenEntity = event.Entity2;
|
||||||
|
otherEntitiy = event.Entity1;
|
||||||
|
kraken = kraken2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ball = m_World->GetComponent<Components::Ball>(otherEntitiy);
|
||||||
|
if (ball != nullptr) {
|
||||||
|
Events::KrakenHit e;
|
||||||
|
e.Kraken = krakenEntity;
|
||||||
|
e.Hitter = otherEntitiy;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::KrakenSystem::OnKrakenAppear(const dd::Events::KrakenAppear &event)
|
||||||
|
{
|
||||||
|
auto ent = m_World->CloneEntity(m_KrakenTemplate);
|
||||||
|
m_World->RemoveComponent<Components::Template>(ent);
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(ent);
|
||||||
|
transform->Position = event.Position;
|
||||||
|
m_KrakenBattle = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::KrakenSystem::OnKrakenAttack(const dd::Events::KrakenAttack &event)
|
||||||
|
{
|
||||||
|
if (event.ChargeUpdate >= 1) {
|
||||||
|
m_ReturnToIdle = true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::KrakenSystem::OnKrakenHit(const dd::Events::KrakenHit &event)
|
||||||
|
{
|
||||||
|
auto kraken = m_World->GetComponent<Components::Kraken>(event.Kraken);
|
||||||
|
//kraken->Health--;
|
||||||
|
//std::cout << kraken->Health << std::endl;
|
||||||
|
kraken->Health = -1;
|
||||||
|
if (kraken->Health < 0) {
|
||||||
|
Events::KrakenDefeated e;
|
||||||
|
e.Kraken = event.Kraken;
|
||||||
|
e.Hitter = event.Hitter;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::KrakenSystem::OnKrakenDefeated(const dd::Events::KrakenDefeated &event)
|
||||||
|
{
|
||||||
|
m_KrakenBattle = false;
|
||||||
|
|
||||||
|
auto kraken = m_World->GetComponent<Components::Kraken>(event.Kraken);
|
||||||
|
auto physicsComponent = m_World->GetComponent<Components::Physics>(event.Kraken);
|
||||||
|
/*physicsComponent->CollisionType = CollisionType::Type::Dynamic;
|
||||||
|
physicsComponent->GravityScale = 1.f;
|
||||||
|
physicsComponent->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Water | CollisionLayer::Wall);
|
||||||
|
physicsComponent->Calculate = false;*/
|
||||||
|
|
||||||
|
auto transformComponentBrick = m_World->GetComponent<Components::Transform>(event.Kraken);
|
||||||
|
auto transformComponentHitter = m_World->GetComponent<Components::Transform>(event.Hitter);
|
||||||
|
|
||||||
|
|
||||||
|
auto brickModel = m_World->GetComponent<Components::Model>(event.Kraken);
|
||||||
|
|
||||||
|
auto cTransform = m_World->GetComponent<Components::Transform>(event.Kraken);
|
||||||
|
/*cTransform->Position = cTransform->Position + transformComponentBrick->Position;
|
||||||
|
glm::vec2 ballToBrick = 4.f * glm::normalize(glm::vec2(cTransform->Position.x - transformComponentHitter->Position.x, cTransform->Position.y - transformComponentHitter->Position.y));
|
||||||
|
cTransform->Velocity = glm::vec3(ballToBrick.x, ballToBrick.y, 0.f);
|
||||||
|
|
||||||
|
std::uniform_real_distribution<float> dist(-1.5f, 1.5f);
|
||||||
|
int impulseStrength = dist(m_RandomGenerator);
|
||||||
|
|
||||||
|
Events::SetImpulse i;
|
||||||
|
i.Entity = event.Kraken;
|
||||||
|
i.Impulse = glm::vec2(impulseStrength, 0.f);
|
||||||
|
i.Point = glm::vec2(cTransform->Position.x, cTransform->Position.y + 0.5f);
|
||||||
|
EventBroker->Publish(i);*/
|
||||||
|
|
||||||
|
auto cModel = m_World->GetComponent<Components::Model>(event.Kraken);
|
||||||
|
cModel->Color = brickModel->Color;
|
||||||
|
cModel->Color *= 0.5f;
|
||||||
|
|
||||||
|
/*m_World->RemoveComponent<Components::Template>(event.Kraken);
|
||||||
|
m_World->SetEntityParent(event.Kraken, 0);
|
||||||
|
m_World->CommitEntity(event.Kraken);*/
|
||||||
|
|
||||||
|
//Particle trail
|
||||||
|
Events::CreateParticleSequence trail;
|
||||||
|
trail.parent = event.Kraken;
|
||||||
|
trail.AlphaValues.push_back(1.f);
|
||||||
|
trail.AlphaValues.push_back(0.f);
|
||||||
|
trail.ScaleValues.push_back(glm::vec3(0.08f));
|
||||||
|
trail.ScaleValues.push_back(glm::vec3(0.f));
|
||||||
|
trail.RadiusDistribution = 1;
|
||||||
|
trail.EmitterLifeTime = 2.f;
|
||||||
|
trail.ParticleLifeTime = 1.f;
|
||||||
|
trail.ParticlesPerTick = 1;
|
||||||
|
trail.SpawnRate = 0.1f;
|
||||||
|
trail.Speed = 10.f;
|
||||||
|
trail.EmittingAngle = glm::half_pi<float>();
|
||||||
|
trail.SpriteFile = "Textures/Particles/FadeBall.png";
|
||||||
|
trail.Color = brickModel->Color;
|
||||||
|
//p.Spread = ...
|
||||||
|
EventBroker->Publish(trail);
|
||||||
|
|
||||||
|
//ParticlePoof
|
||||||
|
Events::CreateParticleSequence poof;
|
||||||
|
poof.EmitterLifeTime = 4;
|
||||||
|
poof.EmittingAngle = glm::half_pi<float>();
|
||||||
|
poof.Spread = 0.5f;
|
||||||
|
poof.NumberOfTicks = 1;
|
||||||
|
poof.ParticleLifeTime = 1.5f;
|
||||||
|
poof.ParticlesPerTick = 1;
|
||||||
|
poof.Position = cTransform->Position;
|
||||||
|
poof.ScaleValues.clear();
|
||||||
|
poof.ScaleValues.push_back(glm::vec3(0.5f));
|
||||||
|
poof.ScaleValues.push_back(glm::vec3(2.f, 2.f, 0.2f));
|
||||||
|
poof.SpriteFile = "Textures/Particles/Cloud_Particle.png";
|
||||||
|
poof.Color = brickModel->Color;
|
||||||
|
poof.AlphaValues.clear();
|
||||||
|
poof.AlphaValues.push_back(1.f);
|
||||||
|
poof.AlphaValues.push_back(0.f);
|
||||||
|
poof.Speed = 10;
|
||||||
|
EventBroker->Publish(poof);
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::KrakenSystem::OnBrickGenerating(const dd::Events::BrickGenerating &event)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
+487
-105
@@ -11,15 +11,211 @@ void dd::Systems::LevelSystem::Initialize()
|
|||||||
{
|
{
|
||||||
std::random_device rd;
|
std::random_device rd;
|
||||||
m_RandomGenerator = std::mt19937(rd());
|
m_RandomGenerator = std::mt19937(rd());
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EContact, &LevelSystem::OnContact);
|
EVENT_SUBSCRIBE_MEMBER(m_EContact, &LevelSystem::OnContact);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EScoreEvent, &LevelSystem::OnScoreEvent);
|
EVENT_SUBSCRIBE_MEMBER(m_EScoreEvent, &LevelSystem::OnScoreEvent);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, &LevelSystem::OnMultiBall);
|
EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, &LevelSystem::OnMultiBall);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ECreatePowerUp, &LevelSystem::OnCreatePowerUp);
|
EVENT_SUBSCRIBE_MEMBER(m_ECreatePowerUp, &LevelSystem::OnCreatePowerUp);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EMultiBallLost, &LevelSystem::OnMultiBallLost);
|
EVENT_SUBSCRIBE_MEMBER(m_EMultiBallLost, &LevelSystem::OnMultiBallLost);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPowerUpTaken, &LevelSystem::OnPowerUpTaken);
|
EVENT_SUBSCRIBE_MEMBER(m_EPowerUpTaken, &LevelSystem::OnPowerUpTaken);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &LevelSystem::OnStageCleared);
|
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &LevelSystem::OnStageCleared);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &LevelSystem::OnPause);
|
EVENT_SUBSCRIBE_MEMBER(m_EArrivedAtNewStage, &LevelSystem::OnArrivedAtNewStage);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EHitPad, &LevelSystem::OnHitPad);
|
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);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EKrakenDefeated, &LevelSystem::OnKrakenDefeated);
|
||||||
|
|
||||||
|
m_GodMode = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue("Cheat.GodMode", false);
|
||||||
|
|
||||||
|
//PointLightTest
|
||||||
|
{
|
||||||
|
auto t_Light = m_World->CreateEntity();
|
||||||
|
auto transform = m_World->AddComponent<Components::Transform>(t_Light);
|
||||||
|
transform->Position = glm::vec3(-3.f, 6.f, -5.f);
|
||||||
|
auto pl = m_World->AddComponent<Components::PointLight>(t_Light);
|
||||||
|
pl->Radius = 20.f;
|
||||||
|
pl->Diffuse = glm::vec3(0.8f, 0.7f, 0.05f);
|
||||||
|
auto model = m_World->AddComponent<Components::Model>(t_Light);
|
||||||
|
model->ModelFile = "Models/Core/UnitSphere.obj";
|
||||||
|
m_World->CommitEntity(t_Light);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto t_Light = m_World->CreateEntity();
|
||||||
|
auto transform = m_World->AddComponent<Components::Transform>(t_Light);
|
||||||
|
transform->Position = glm::vec3(3.f, -5.f, -5.f);
|
||||||
|
auto pl = m_World->AddComponent<Components::PointLight>(t_Light);
|
||||||
|
pl->Radius = 15.f;
|
||||||
|
pl->Diffuse = glm::vec3(0.1f, 0.5f, 0.8f);
|
||||||
|
auto model = m_World->AddComponent<Components::Model>(t_Light);
|
||||||
|
model->ModelFile = "Models/Core/UnitSphere.obj";
|
||||||
|
m_World->CommitEntity(t_Light);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Halfpipe background test model.
|
||||||
|
{
|
||||||
|
auto t_halfPipe = m_World->CreateEntity();
|
||||||
|
auto transform = m_World->AddComponent<Components::Transform>(t_halfPipe);
|
||||||
|
auto background = m_World->AddComponent<Components::Background>(t_halfPipe);
|
||||||
|
transform->Position = glm::vec3(0.f, 0.f, -15.f);
|
||||||
|
transform->Scale = glm::vec3(6.f, 6.f, 10.f);
|
||||||
|
auto travels = m_World->AddComponent<Components::Travels>(t_halfPipe);
|
||||||
|
travels->CurrentlyTraveling = false;
|
||||||
|
auto model = m_World->AddComponent<Components::Model>(t_halfPipe);
|
||||||
|
model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj";
|
||||||
|
model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 1.f);
|
||||||
|
m_World->CommitEntity(t_halfPipe);
|
||||||
|
|
||||||
|
auto t_halfPipe2 = m_World->CloneEntity(t_halfPipe);
|
||||||
|
auto transform2 = m_World->GetComponent<Components::Transform>(t_halfPipe);
|
||||||
|
transform2->Position = glm::vec3(0.f, 34.6f, -15.f); //Halfpipe Value
|
||||||
|
}
|
||||||
|
|
||||||
|
//Background
|
||||||
|
|
||||||
|
/*{
|
||||||
|
auto background = m_World->CreateEntity();
|
||||||
|
auto transform = m_World->AddComponent<Components::Transform>(background);
|
||||||
|
auto travels = m_World->AddComponent<Components::Travels>(background);
|
||||||
|
travels->CurrentlyTraveling = false;
|
||||||
|
auto backgroundComponent = m_World->AddComponent<Components::Background>(background);
|
||||||
|
transform->Position = glm::vec3(0.f, 0.f, -30.f);
|
||||||
|
transform->Scale = glm::vec3(2681.f / 50.f, 1080.f / 50.f, 1.f);
|
||||||
|
auto sprite = m_World->AddComponent<Components::Sprite>(background);
|
||||||
|
sprite->SpriteFile = "Textures/Background.png";
|
||||||
|
m_World->CommitEntity(background);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// auto particleEmitter= m_World->AddComponent<Components::Emitter>(Pe);
|
||||||
|
|
||||||
|
|
||||||
|
//ParticleTest
|
||||||
|
|
||||||
|
|
||||||
|
/*{
|
||||||
|
auto Pe = m_World->CreateEntity();
|
||||||
|
auto transform = m_World->AddComponent<Components::Transform>(Pe);
|
||||||
|
auto particleEmitter= m_World->AddComponent<Components::ParticleEmitter>(Pe);
|
||||||
|
auto emitteSprite = m_World->AddComponent<Components::Sprite>(Pe);
|
||||||
|
|
||||||
|
transform->Position = glm::vec3(0.f, 0.f, -10.f);
|
||||||
|
emitteSprite->SpriteFile = "Textures/Test/Brick_Normal.png";
|
||||||
|
particleEmitter->GravityScale = 0.0f;
|
||||||
|
particleEmitter->SpawnRate = 1.f;
|
||||||
|
particleEmitter->NumberOfTicks = 2;
|
||||||
|
particleEmitter->Speed = 1.f;
|
||||||
|
particleEmitter->ParticlesPerTick = 5;
|
||||||
|
particleEmitter->Spread = glm::pi<float>()*2;
|
||||||
|
particleEmitter->EmittingAngle = glm::pi<float>();
|
||||||
|
particleEmitter->LifeTime = 50;
|
||||||
|
|
||||||
|
{
|
||||||
|
auto Pt = m_World->CreateEntity(Pe);
|
||||||
|
auto PtTransform = m_World->AddComponent<Components::Transform>(Pt);
|
||||||
|
auto PtSprite = m_World->AddComponent<Components::Sprite>(Pt);
|
||||||
|
auto PtParticle = m_World->AddComponent<Components::Particle>(Pt);
|
||||||
|
auto PtTemplate = m_World->AddComponent<Components::Template>(Pt);
|
||||||
|
|
||||||
|
//PtTransform->Velocity = glm::vec3(1.0f, 0.f, 0.f);
|
||||||
|
PtTransform->Position = transform->Position;
|
||||||
|
PtSprite->SpriteFile = "Textures/Background.png";
|
||||||
|
PtParticle->LifeTime = 3.f;
|
||||||
|
PtParticle->Flags = static_cast<ParticleFlags::Type>(ParticleFlags::Type::Powder | ParticleFlags::Type::ParticleContactFilter | ParticleFlags::Type::FixtureContactFilter);
|
||||||
|
}
|
||||||
|
m_World->CommitEntity(Pe);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//TODO: Why does the ball not collide with these bricks?
|
||||||
|
//BottomBox
|
||||||
|
{
|
||||||
|
EntityID BottomWall = m_World->CreateEntity();
|
||||||
|
auto transform = m_World->AddComponent<Components::Transform>(BottomWall);
|
||||||
|
auto wall = m_World->AddComponent<Components::Wall>(BottomWall);
|
||||||
|
transform->Position = glm::vec3(0.f, -6.f, -10.f);
|
||||||
|
transform->Scale = glm::vec3(20.f, 0.5f, 1.f);
|
||||||
|
std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(BottomWall);
|
||||||
|
sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
|
||||||
|
std::shared_ptr<Components::RectangleShape> rectangleShape = m_World->AddComponent<Components::RectangleShape>(BottomWall);
|
||||||
|
rectangleShape->Dimensions = glm::vec2(20.f, 0.5f);
|
||||||
|
std::shared_ptr<Components::Physics> physics = m_World->AddComponent<Components::Physics>(BottomWall);
|
||||||
|
physics->CollisionType = CollisionType::Type::Static;
|
||||||
|
physics->Category = CollisionLayer::Wall;
|
||||||
|
if (m_GodMode) {
|
||||||
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::LifeBuoy | CollisionLayer::Ball);
|
||||||
|
} else {
|
||||||
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::LifeBuoy);
|
||||||
|
}
|
||||||
|
m_World->CommitEntity(BottomWall);
|
||||||
|
|
||||||
|
m_World->SetProperty(BottomWall, "Name", "BottomWall");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto topWall = m_World->CreateEntity();
|
||||||
|
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(topWall);
|
||||||
|
transform->Position = glm::vec3(0.f, 6.f, -10.f);
|
||||||
|
transform->Scale = glm::vec3(20.f, 0.5f, 1.f);
|
||||||
|
|
||||||
|
auto wall = m_World->AddComponent<Components::Wall>(topWall);
|
||||||
|
|
||||||
|
//std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(topWall);
|
||||||
|
//sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
|
||||||
|
|
||||||
|
std::shared_ptr<Components::RectangleShape> rectangleShape = m_World->AddComponent<Components::RectangleShape>(topWall);
|
||||||
|
rectangleShape->Dimensions = glm::vec2(20.f, 0.5f);
|
||||||
|
|
||||||
|
std::shared_ptr<Components::Physics> physics = m_World->AddComponent<Components::Physics>(topWall);
|
||||||
|
physics->CollisionType = CollisionType::Type::Static;
|
||||||
|
physics->Category = CollisionLayer::Wall;
|
||||||
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::Brick);
|
||||||
|
|
||||||
|
m_World->CommitEntity(topWall);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto leftWall = m_World->CreateEntity();
|
||||||
|
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(
|
||||||
|
leftWall);
|
||||||
|
transform->Position = glm::vec3(-4.f, 1.f, -10.f);
|
||||||
|
transform->Scale = glm::vec3(0.5f, 20.f, 1.f);
|
||||||
|
|
||||||
|
auto wall = m_World->AddComponent<Components::Wall>(leftWall);
|
||||||
|
|
||||||
|
//std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(leftWall);
|
||||||
|
//sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
|
||||||
|
|
||||||
|
std::shared_ptr<Components::RectangleShape> rectangleShape = m_World->AddComponent<Components::RectangleShape>(leftWall);
|
||||||
|
rectangleShape->Dimensions = glm::vec2(0.5f, 20.f);
|
||||||
|
|
||||||
|
std::shared_ptr<Components::Physics> physics = m_World->AddComponent<Components::Physics>(leftWall);
|
||||||
|
physics->CollisionType = CollisionType::Type::Static;
|
||||||
|
physics->Category = CollisionLayer::Wall;
|
||||||
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::Brick);
|
||||||
|
|
||||||
|
m_World->CommitEntity(leftWall);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto rightWall = m_World->CreateEntity();
|
||||||
|
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(
|
||||||
|
rightWall);
|
||||||
|
transform->Position = glm::vec3(4.f, 1.f, -10.f);
|
||||||
|
transform->Scale = glm::vec3(0.5f, 20.f, 1.f);
|
||||||
|
|
||||||
|
auto wall = m_World->AddComponent<Components::Wall>(rightWall);
|
||||||
|
|
||||||
|
//std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(rightWall);
|
||||||
|
//sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
|
||||||
|
|
||||||
|
std::shared_ptr<Components::RectangleShape> rectangleShape = m_World->AddComponent<Components::RectangleShape>(rightWall);
|
||||||
|
rectangleShape->Dimensions = glm::vec2(0.5f, 20.f);
|
||||||
|
|
||||||
|
std::shared_ptr<Components::Physics> physics = m_World->AddComponent<Components::Physics>(rightWall);
|
||||||
|
physics->CollisionType = CollisionType::Type::Static;
|
||||||
|
physics->Category = CollisionLayer::Wall;
|
||||||
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::Brick);
|
||||||
|
|
||||||
|
m_World->CommitEntity(rightWall);
|
||||||
|
}
|
||||||
|
|
||||||
m_BrickTemplate = m_World->CreateEntity();
|
m_BrickTemplate = m_World->CreateEntity();
|
||||||
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(m_BrickTemplate);
|
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(m_BrickTemplate);
|
||||||
@@ -29,11 +225,14 @@ void dd::Systems::LevelSystem::Initialize()
|
|||||||
cRec->Dimensions = glm::vec2(0.9f, 0.35f);
|
cRec->Dimensions = glm::vec2(0.9f, 0.35f);
|
||||||
std::shared_ptr<Components::Physics> cPhys = m_World->AddComponent<Components::Physics>(m_BrickTemplate);
|
std::shared_ptr<Components::Physics> cPhys = m_World->AddComponent<Components::Physics>(m_BrickTemplate);
|
||||||
std::shared_ptr<Components::Template> cTemplate = m_World->AddComponent<Components::Template>(m_BrickTemplate);
|
std::shared_ptr<Components::Template> cTemplate = m_World->AddComponent<Components::Template>(m_BrickTemplate);
|
||||||
|
|
||||||
|
auto travels = m_World->AddComponent<Components::Travels>(m_BrickTemplate);
|
||||||
|
travels->CurrentlyTraveling = false;
|
||||||
|
|
||||||
cPhys->CollisionType = CollisionType::Type::Static;
|
cPhys->CollisionType = CollisionType::Type::Static;
|
||||||
cPhys->GravityScale = 0.f;
|
cPhys->GravityScale = 0.f;
|
||||||
cPhys->Category = CollisionLayer::Type::Brick;
|
cPhys->Category = CollisionLayer::Type::Brick;
|
||||||
cPhys->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Type::Ball | CollisionLayer::Type::Projectile | CollisionLayer::Type::Wall | CollisionLayer::LifeBuoy);
|
cPhys->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Type::Ball | CollisionLayer::Type::Projectile | CollisionLayer::Type::Wall | CollisionLayer::LifeBuoy);
|
||||||
transform->Sticky = false;
|
|
||||||
|
|
||||||
model->ModelFile = "Models/Brick/WhiteBrick.obj";
|
model->ModelFile = "Models/Brick/WhiteBrick.obj";
|
||||||
transform->Position = glm::vec3(50, 50, -10);
|
transform->Position = glm::vec3(50, 50, -10);
|
||||||
@@ -62,15 +261,19 @@ void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
if (templateCheck != nullptr){ return; }
|
if (templateCheck != nullptr){ return; }
|
||||||
|
|
||||||
// Check the background.
|
// Check the background.
|
||||||
auto model = m_World->GetComponent<Components::Model>(entity);
|
auto background = m_World->GetComponent<Components::Background>(entity);
|
||||||
if (model != nullptr) {
|
if (background != nullptr) {
|
||||||
if (model->ModelFile == "Models/Test/halfpipe/Halfpipe.obj") {
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
if (transform->Position.y <= -34.6) { //Halfpipe Value.
|
||||||
if (transform->Position.y <= -34.6) {
|
transform->Position.y = 34.6;
|
||||||
transform->Position.y = 34.6;
|
Events::Move e;
|
||||||
}
|
e.Entity = entity;
|
||||||
}
|
e.GoalPosition = glm::vec3(transform->Position.x, 34.6 + background->distanceLeftToCorrectTravelPosition, transform->Position.z);
|
||||||
}
|
e.Speed = 6.0f;
|
||||||
|
e.Queue = false;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto brick = m_World->GetComponent<Components::Brick>(entity);
|
auto brick = m_World->GetComponent<Components::Brick>(entity);
|
||||||
if (brick != nullptr) {
|
if (brick != nullptr) {
|
||||||
@@ -88,9 +291,12 @@ void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
} else if (brick->Type == StickyBrick) {
|
} else if (brick->Type == StickyBrick) {
|
||||||
Events::StickyPad e;
|
Events::StickyPad e;
|
||||||
|
e.Times = 3;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
} else if (brick->Type == InkBlasterBrick) {
|
} else if (brick->Type == InkBlasterBrick) {
|
||||||
Events::InkBlaster e;
|
Events::InkBlaster e;
|
||||||
|
e.Shots = 5;
|
||||||
|
e.Speed = 7;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
} else if(brick->Type == KrakenAttackBrick) {
|
} else if(brick->Type == KrakenAttackBrick) {
|
||||||
Events::KrakenAttack e;
|
Events::KrakenAttack e;
|
||||||
@@ -111,6 +317,7 @@ void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
Events::StageCleared ec;
|
Events::StageCleared ec;
|
||||||
ec.ClearedStage = m_CurrentLevel;
|
ec.ClearedStage = m_CurrentLevel;
|
||||||
ec.StageCluster = m_CurrentCluster;
|
ec.StageCluster = m_CurrentCluster;
|
||||||
|
ec.StagesInCluster = m_StagesInCluster;
|
||||||
EventBroker->Publish(ec);
|
EventBroker->Publish(ec);
|
||||||
} else {
|
} else {
|
||||||
if (ball != nullptr && MultiBalls() > 0) {
|
if (ball != nullptr && MultiBalls() > 0) {
|
||||||
@@ -135,18 +342,24 @@ void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
|
|
||||||
bool dd::Systems::LevelSystem::OnPause(const dd::Events::Pause &event)
|
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;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
m_Pause = true;
|
||||||
|
|
||||||
if (IsPaused()) {
|
|
||||||
SetPause(false);
|
|
||||||
} else {
|
|
||||||
SetPause(true);
|
|
||||||
}
|
|
||||||
return 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)
|
void dd::Systems::LevelSystem::CreateBasicLevel(int rows, int lines, glm::vec2 spacesBetweenBricks, float spaceToEdge)
|
||||||
{
|
{
|
||||||
SetNumberOfBricks(rows * lines);
|
SetNumberOfBricks(rows * lines);
|
||||||
@@ -187,17 +400,22 @@ void dd::Systems::LevelSystem::CreateLevel(int aboveBasicLevel)
|
|||||||
SetRestarting(false);
|
SetRestarting(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBetweenBricks, float spaceToEdge, int aboveLevel, int num, int typeInt, glm::vec4 colorVec)
|
EntityID dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBetweenBricks, float spaceToEdge, int aboveLevel, int num, int typeInt, glm::vec4 colorVec)
|
||||||
{
|
{
|
||||||
if (typeInt == EmptyBrickSpace) {
|
if (typeInt == EmptyBrickSpace) {
|
||||||
SetNumberOfBricks(NumberOfBricks() - 1);
|
SetNumberOfBricks(NumberOfBricks() - 1);
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
auto brick = m_World->CloneEntity(m_BrickTemplate);
|
auto brick = m_World->CloneEntity(m_BrickTemplate);
|
||||||
m_World->RemoveComponent<Components::Template>(brick);
|
m_World->RemoveComponent<Components::Template>(brick);
|
||||||
auto transform = m_World->GetComponent<Components::Transform>(brick);
|
auto transform = m_World->GetComponent<Components::Transform>(brick);
|
||||||
auto cBrick = m_World->GetComponent<Components::Brick>(brick);
|
auto cBrick = m_World->GetComponent<Components::Brick>(brick);
|
||||||
auto model = m_World->GetComponent<Components::Model>(brick);
|
auto model = m_World->GetComponent<Components::Model>(brick);
|
||||||
|
|
||||||
|
float x = line * spacesBetweenBricks.x;
|
||||||
|
float y = row * spacesBetweenBricks.y;
|
||||||
|
transform->Position = glm::vec3(x - 3, 5 - spaceToEdge - y + aboveLevel, -10.f);
|
||||||
|
|
||||||
if (typeInt == StandardBrick) {
|
if (typeInt == StandardBrick) {
|
||||||
cBrick->Type = StandardBrick;
|
cBrick->Type = StandardBrick;
|
||||||
auto type = m_World->AddComponent<Components::StandardBrick>(brick);
|
auto type = m_World->AddComponent<Components::StandardBrick>(brick);
|
||||||
@@ -222,17 +440,135 @@ void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBe
|
|||||||
} else if (typeInt == KrakenAttackBrick) {
|
} else if (typeInt == KrakenAttackBrick) {
|
||||||
cBrick->Type = KrakenAttackBrick;
|
cBrick->Type = KrakenAttackBrick;
|
||||||
auto type = m_World->AddComponent<Components::KrakenAttackBrick>(brick);
|
auto type = m_World->AddComponent<Components::KrakenAttackBrick>(brick);
|
||||||
model->Color = glm::vec4(0.f, 0.5f, 1.0f, .0f);
|
model->Color = glm::vec4(0.f, 0.5f, 1.0f, 1.0f);
|
||||||
|
} else if (typeInt == Kraken) {
|
||||||
|
Events::KrakenAppear e;
|
||||||
|
e.Position = transform->Position;
|
||||||
|
e.Health = 10;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
m_World->RemoveEntity(brick);
|
||||||
|
return brick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float x = line * spacesBetweenBricks.x;
|
|
||||||
float y = row * spacesBetweenBricks.y;
|
|
||||||
transform->Position = glm::vec3(x - 3, 5 - spaceToEdge - y + aboveLevel, -10.f);
|
|
||||||
cBrick->Score = 10 * num;
|
cBrick->Score = 10 * num;
|
||||||
return;
|
return brick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::LevelSystem::OnBrickGenerating(const dd::Events::BrickGenerating &event)
|
||||||
|
{
|
||||||
|
GetBrickSet(event.Set);
|
||||||
|
LOG_DEBUG("This is happening.");
|
||||||
|
|
||||||
|
int rows = 2;
|
||||||
|
int lines = 7;
|
||||||
|
int getter = 0;
|
||||||
|
for (int i = 0; i < rows; i++) {
|
||||||
|
for (int j = 0; j < lines; j++) {
|
||||||
|
auto ent = CreateBrick(i, j, SpaceBetweenBricks(), SpaceToEdge(), -4, 1, m_BrickSet[getter], m_ColorSet[getter]);
|
||||||
|
if (ent != NULL) {
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(ent);
|
||||||
|
Events::Move e;
|
||||||
|
e.GoalPosition = transform->Position;
|
||||||
|
transform->Position = event.Origin;
|
||||||
|
e.Entity = ent;
|
||||||
|
e.Speed = 6;
|
||||||
|
e.Queue = false;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
m_LooseBricks++;
|
||||||
|
SetNumberOfBricks(NumberOfBricks() + 1);
|
||||||
|
}
|
||||||
|
getter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dd::Systems::LevelSystem::GetBrickSet(int set)
|
||||||
|
{
|
||||||
|
std::array<int, 14> level;
|
||||||
|
std::array<glm::vec4, 14> color;
|
||||||
|
// Level array indicates type of brick.
|
||||||
|
// 0 is empty space.
|
||||||
|
// 1 is standard brick.
|
||||||
|
// 2 is multiball brick.
|
||||||
|
// 3 is lifebuoy brick.
|
||||||
|
// 4 is sticky brick.
|
||||||
|
// 5 is ink blaster brick.
|
||||||
|
// 6 is kraken attack brick.
|
||||||
|
|
||||||
|
// color array determines the color of standard bricks.
|
||||||
|
// w is white.
|
||||||
|
// r is red.
|
||||||
|
// g is green.
|
||||||
|
// b is blue.
|
||||||
|
// y is yellow.
|
||||||
|
// c is cyan.
|
||||||
|
// m is magenta.
|
||||||
|
// d is dark.
|
||||||
|
// Feel free to make your own.
|
||||||
|
glm::vec4 w = glm::vec4(1, 1, 1, 1);
|
||||||
|
glm::vec4 r = glm::vec4(1, 0, 0, 1);
|
||||||
|
glm::vec4 g = glm::vec4(0, 1, 0, 1);
|
||||||
|
glm::vec4 b = glm::vec4(0, 0, 1, 1);
|
||||||
|
glm::vec4 y = glm::vec4(1, 1, 0, 1);
|
||||||
|
glm::vec4 c = glm::vec4(0, 1, 1, 1);
|
||||||
|
glm::vec4 m = glm::vec4(1, 0, 1, 1);
|
||||||
|
glm::vec4 d = glm::vec4(0, 0, 0, 1);
|
||||||
|
|
||||||
|
if (set == 1) {
|
||||||
|
level =
|
||||||
|
{1, 1, 1, 1, 1, 1, 1,
|
||||||
|
1, 1, 1, 1, 1, 1, 1 };
|
||||||
|
color =
|
||||||
|
{r, r, r, r, r, r, r,
|
||||||
|
r, r, r, r, r, r, r };
|
||||||
|
}
|
||||||
|
else if (set == 2) {
|
||||||
|
level =
|
||||||
|
{2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2 };
|
||||||
|
color =
|
||||||
|
{w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w };
|
||||||
|
}
|
||||||
|
else if (set == 3) {
|
||||||
|
level =
|
||||||
|
{0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
color =
|
||||||
|
{w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w };
|
||||||
|
}
|
||||||
|
else if (set == 4) {
|
||||||
|
level =
|
||||||
|
{0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
color =
|
||||||
|
{w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w };
|
||||||
|
}
|
||||||
|
else if (set == 5) {
|
||||||
|
level =
|
||||||
|
{0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
color =
|
||||||
|
{w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w };
|
||||||
|
}
|
||||||
|
else if (set == 6) {
|
||||||
|
level =
|
||||||
|
{0, 0, 0, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
color =
|
||||||
|
{w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w };
|
||||||
|
}
|
||||||
|
|
||||||
|
std::copy(std::begin(level), std::end(level), std::begin(m_BrickSet));
|
||||||
|
std::copy(std::begin(color), std::end(color), std::begin(m_ColorSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void dd::Systems::LevelSystem::OnEntityRemoved(EntityID entity)
|
void dd::Systems::LevelSystem::OnEntityRemoved(EntityID entity)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -349,6 +685,7 @@ void dd::Systems::LevelSystem::BrickHit(EntityID entityHitter, EntityID entityBr
|
|||||||
Events::InkBlaster e;
|
Events::InkBlaster e;
|
||||||
e.Transform = transformComponentBrick;
|
e.Transform = transformComponentBrick;
|
||||||
e.Shots = 5;
|
e.Shots = 5;
|
||||||
|
e.Speed = 7;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -371,8 +708,6 @@ void dd::Systems::LevelSystem::BrickHit(EntityID entityHitter, EntityID entityBr
|
|||||||
auto brickChildren = m_World->GetEntityChildren(entityBrick);
|
auto brickChildren = m_World->GetEntityChildren(entityBrick);
|
||||||
for (auto b : brickChildren)
|
for (auto b : brickChildren)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
auto cTransform = m_World->GetComponent<Components::Transform>(b);
|
auto cTransform = m_World->GetComponent<Components::Transform>(b);
|
||||||
cTransform->Position = cTransform->Position + transformComponentBrick->Position;
|
cTransform->Position = cTransform->Position + transformComponentBrick->Position;
|
||||||
glm::vec2 ballToBrick = 4.f * glm::normalize(glm::vec2(cTransform->Position.x - transformComponentHitter->Position.x, cTransform->Position.y - transformComponentHitter->Position.y));
|
glm::vec2 ballToBrick = 4.f * glm::normalize(glm::vec2(cTransform->Position.x - transformComponentHitter->Position.x, cTransform->Position.y - transformComponentHitter->Position.y));
|
||||||
@@ -478,7 +813,6 @@ bool dd::Systems::LevelSystem::OnCreatePowerUp(const dd::Events::CreatePowerUp &
|
|||||||
cPhys->CollisionType = CollisionType::Type::Dynamic;
|
cPhys->CollisionType = CollisionType::Type::Dynamic;
|
||||||
cPhys->Category = CollisionLayer::Type::PowerUp;
|
cPhys->Category = CollisionLayer::Type::PowerUp;
|
||||||
cPhys->Mask = CollisionLayer::Type::Pad;
|
cPhys->Mask = CollisionLayer::Type::Pad;
|
||||||
transform->Sticky = false;
|
|
||||||
|
|
||||||
std::shared_ptr<Components::PowerUp> cPow = m_World->AddComponent<Components::PowerUp>(powerUp);
|
std::shared_ptr<Components::PowerUp> cPow = m_World->AddComponent<Components::PowerUp>(powerUp);
|
||||||
|
|
||||||
@@ -499,6 +833,16 @@ bool dd::Systems::LevelSystem::OnPowerUpTaken(const dd::Events::PowerUpTaken &ev
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::LevelSystem::OnKrakenDefeated(const dd::Events::KrakenDefeated &event)
|
||||||
|
{
|
||||||
|
SetNumberOfBricks(NumberOfBricks() - 1);
|
||||||
|
m_LooseBricks--;
|
||||||
|
|
||||||
|
std::cout << m_LooseBricks << std::endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool dd::Systems::LevelSystem::OnStageCleared(const dd::Events::StageCleared &event)
|
bool dd::Systems::LevelSystem::OnStageCleared(const dd::Events::StageCleared &event)
|
||||||
{
|
{
|
||||||
if (!m_Cleared) {
|
if (!m_Cleared) {
|
||||||
@@ -510,12 +854,13 @@ bool dd::Systems::LevelSystem::OnStageCleared(const dd::Events::StageCleared &ev
|
|||||||
es.Score = 500;
|
es.Score = 500;
|
||||||
EventBroker->Publish(es);
|
EventBroker->Publish(es);
|
||||||
m_CurrentLevel++;
|
m_CurrentLevel++;
|
||||||
if (m_CurrentLevel < 6) {
|
if (m_CurrentLevel <= event.StagesInCluster) {
|
||||||
GetNextLevel();
|
GetNextLevel();
|
||||||
CreateLevel(12);
|
CreateLevel(12); //NextLevelDistance
|
||||||
} else {
|
} else {
|
||||||
// Win
|
// Win
|
||||||
Events::ClusterClear e;
|
Events::ClusterClear e;
|
||||||
|
e.ClusterCleared = m_CurrentCluster;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
|
|
||||||
Events::Pause p;
|
Events::Pause p;
|
||||||
@@ -526,6 +871,12 @@ bool dd::Systems::LevelSystem::OnStageCleared(const dd::Events::StageCleared &ev
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::LevelSystem::OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event)
|
||||||
|
{
|
||||||
|
m_Cleared = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void dd::Systems::LevelSystem::GetNextLevel()
|
void dd::Systems::LevelSystem::GetNextLevel()
|
||||||
{
|
{
|
||||||
std::array<int, 42> level;
|
std::array<int, 42> level;
|
||||||
@@ -539,7 +890,9 @@ void dd::Systems::LevelSystem::GetNextLevel()
|
|||||||
// 5 is ink blaster brick.
|
// 5 is ink blaster brick.
|
||||||
// 6 is kraken attack brick.
|
// 6 is kraken attack brick.
|
||||||
|
|
||||||
// wolor array determines the color of standard bricks.
|
// 100 is KRAKEN!
|
||||||
|
|
||||||
|
// color array determines the color of standard bricks.
|
||||||
// w is white.
|
// w is white.
|
||||||
// r is red.
|
// r is red.
|
||||||
// g is green.
|
// g is green.
|
||||||
@@ -572,70 +925,8 @@ void dd::Systems::LevelSystem::GetNextLevel()
|
|||||||
glm::vec4 p4 = glm::vec4(125.f / 255.f, 0.f / 255.f, 147.f / 255.f, 1.f);
|
glm::vec4 p4 = glm::vec4(125.f / 255.f, 0.f / 255.f, 147.f / 255.f, 1.f);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (m_CurrentCluster == 0) {
|
if (m_CurrentCluster == 0) {
|
||||||
if (m_CurrentLevel == 1) {
|
if (m_CurrentLevel == 1) {
|
||||||
level =
|
|
||||||
{0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 1, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0};
|
|
||||||
color =
|
|
||||||
{w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w};
|
|
||||||
} else if (m_CurrentLevel == 2) {
|
|
||||||
level =
|
|
||||||
{1, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0};
|
|
||||||
color =
|
|
||||||
{w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w};
|
|
||||||
} else if (m_CurrentLevel == 3) {
|
|
||||||
level =
|
|
||||||
{0, 0, 0, 0, 0, 0, 1,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0};
|
|
||||||
color =
|
|
||||||
{w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w};
|
|
||||||
} else if (m_CurrentLevel == 4) {
|
|
||||||
level =
|
|
||||||
{0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
1, 0, 0, 0, 0, 0, 0};
|
|
||||||
color =
|
|
||||||
{w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w,
|
|
||||||
w, w, w, w, w, w, w};
|
|
||||||
} else if (m_CurrentLevel == 5) {
|
|
||||||
level =
|
level =
|
||||||
{0, 0, 0, 0, 0, 0, 0,
|
{0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
@@ -650,7 +941,82 @@ void dd::Systems::LevelSystem::GetNextLevel()
|
|||||||
w, w, w, w, w, w, w,
|
w, w, w, w, w, w, w,
|
||||||
w, w, w, w, w, w, w,
|
w, w, w, w, w, w, w,
|
||||||
w, w, w, w, w, w, w};
|
w, w, w, w, w, w, w};
|
||||||
}
|
} else if (m_CurrentLevel == 2) {
|
||||||
|
level =
|
||||||
|
{0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 100, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0};
|
||||||
|
color =
|
||||||
|
{w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w};
|
||||||
|
} else if (m_CurrentLevel == 3) {
|
||||||
|
level =
|
||||||
|
{0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
1, 0, 0, 0, 0, 0, 0};
|
||||||
|
color =
|
||||||
|
{w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w};
|
||||||
|
} else if (m_CurrentLevel == 4) {
|
||||||
|
level =
|
||||||
|
{0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 1};
|
||||||
|
color =
|
||||||
|
{w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w};
|
||||||
|
} else if (m_CurrentLevel == 5) {
|
||||||
|
level =
|
||||||
|
{0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0};
|
||||||
|
color =
|
||||||
|
{w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w};
|
||||||
|
} else if (m_CurrentLevel == 6) {
|
||||||
|
level =
|
||||||
|
{0, 0, 0, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0};
|
||||||
|
color =
|
||||||
|
{w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w};
|
||||||
|
}
|
||||||
} else if (m_CurrentCluster == 1) {
|
} else if (m_CurrentCluster == 1) {
|
||||||
if (m_CurrentLevel == 1) {
|
if (m_CurrentLevel == 1) {
|
||||||
level =
|
level =
|
||||||
@@ -658,7 +1024,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,
|
||||||
1, 0, 1, 0, 1, 0, 1,
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
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,
|
||||||
@@ -727,7 +1093,23 @@ void dd::Systems::LevelSystem::GetNextLevel()
|
|||||||
w, br, w, g, w, lb1, w,
|
w, br, w, g, w, lb1, w,
|
||||||
y, w, y, d, b, w, b,
|
y, w, y, d, b, w, b,
|
||||||
w, br, w, w, w, lb1, w};
|
w, br, w, w, w, lb1, w};
|
||||||
}
|
}
|
||||||
|
else if (m_CurrentLevel == 6) {
|
||||||
|
level =
|
||||||
|
{0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 100, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0};
|
||||||
|
color =
|
||||||
|
{w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w,
|
||||||
|
w, w, w, w, w, w, w};
|
||||||
|
}
|
||||||
} else if (m_CurrentCluster == 3) {
|
} else if (m_CurrentCluster == 3) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -11,6 +11,7 @@ void dd::Systems::LifebuoySystem::Initialize()
|
|||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EContact, &LifebuoySystem::OnContact);
|
EVENT_SUBSCRIBE_MEMBER(m_EContact, &LifebuoySystem::OnContact);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &LifebuoySystem::OnPause);
|
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_ELifebuoy, &LifebuoySystem::OnLifebuoy);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ELifebuoyHit, &LifebuoySystem::OnLifebuoyHit);
|
EVENT_SUBSCRIBE_MEMBER(m_ELifebuoyHit, &LifebuoySystem::OnLifebuoyHit);
|
||||||
|
|
||||||
@@ -29,7 +30,6 @@ void dd::Systems::LifebuoySystem::Initialize()
|
|||||||
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::Brick | CollisionLayer::LifeBuoy | CollisionLayer::Pad | CollisionLayer::Water);
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::Brick | CollisionLayer::LifeBuoy | CollisionLayer::Pad | CollisionLayer::Water);
|
||||||
physics->Density = 1.0f;
|
physics->Density = 1.0f;
|
||||||
physics->GravityScale = 1;
|
physics->GravityScale = 1;
|
||||||
ctransform->Sticky = true;
|
|
||||||
auto cModel = m_World->AddComponent<Components::Model>(ent);
|
auto cModel = m_World->AddComponent<Components::Model>(ent);
|
||||||
cModel->ModelFile = "Models/Lifebuoy/Lifebuoy1.obj";
|
cModel->ModelFile = "Models/Lifebuoy/Lifebuoy1.obj";
|
||||||
auto lifebuoy = m_World->AddComponent<Components::Lifebuoy>(ent);
|
auto lifebuoy = m_World->AddComponent<Components::Lifebuoy>(ent);
|
||||||
@@ -89,18 +89,23 @@ void dd::Systems::LifebuoySystem::UpdateEntity(double dt, EntityID entity, Entit
|
|||||||
|
|
||||||
bool dd::Systems::LifebuoySystem::OnPause(const dd::Events::Pause &event)
|
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;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
m_Pause = true;
|
||||||
|
|
||||||
if (IsPaused()) {
|
|
||||||
SetPause(false);
|
|
||||||
} else {
|
|
||||||
SetPause(true);
|
|
||||||
}
|
|
||||||
return 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)
|
bool dd::Systems::LifebuoySystem::OnContact(const dd::Events::Contact &event)
|
||||||
{
|
{
|
||||||
@@ -127,9 +132,30 @@ bool dd::Systems::LifebuoySystem::OnLifebuoy(const dd::Events::Lifebuoy &event)
|
|||||||
|
|
||||||
bool dd::Systems::LifebuoySystem::OnLifebuoyHit(const dd::Events::LifebuoyHit &event)
|
bool dd::Systems::LifebuoySystem::OnLifebuoyHit(const dd::Events::LifebuoyHit &event)
|
||||||
{
|
{
|
||||||
|
auto transformComponent = m_World->GetComponent<Components::Transform>(event.Lifebuoy);
|
||||||
auto lifebuoyComponent = m_World->GetComponent<Components::Lifebuoy>(event.Lifebuoy);
|
auto lifebuoyComponent = m_World->GetComponent<Components::Lifebuoy>(event.Lifebuoy);
|
||||||
lifebuoyComponent->Hits -= 1;
|
lifebuoyComponent->Hits -= 1;
|
||||||
auto modelComponent = m_World->GetComponent<Components::Model>(event.Lifebuoy);
|
auto modelComponent = m_World->GetComponent<Components::Model>(event.Lifebuoy);
|
||||||
modelComponent->ModelFile = "Models/Lifebuoy/Lifebuoy" + std::to_string(5 - lifebuoyComponent->Hits) + ".obj";
|
modelComponent->ModelFile = "Models/Lifebuoy/Lifebuoy" + std::to_string(5 - lifebuoyComponent->Hits) + ".obj";
|
||||||
|
|
||||||
|
Events::CreateParticleSequence e;
|
||||||
|
e.EmitterLifeTime = 4;
|
||||||
|
e.EmittingAngle = glm::half_pi<float>();
|
||||||
|
e.Spread = 0.5f;
|
||||||
|
e.NumberOfTicks = 1;
|
||||||
|
e.ParticleLifeTime = 1.f;
|
||||||
|
e.ParticlesPerTick = 1;
|
||||||
|
e.Position = transformComponent->Position;
|
||||||
|
e.ScaleValues.clear();
|
||||||
|
e.ScaleValues.push_back(glm::vec3(0.5f));
|
||||||
|
e.ScaleValues.push_back(glm::vec3(2.f, 2.f, 0.2f));
|
||||||
|
e.SpriteFile = "Textures/Particles/Cloud_Particle.png";
|
||||||
|
e.Color = glm::vec4(1, 0, 0, 1);
|
||||||
|
e.AlphaValues.clear();
|
||||||
|
e.AlphaValues.push_back(1.f);
|
||||||
|
e.AlphaValues.push_back(0.f);
|
||||||
|
e.Speed = 10.f;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+110
-18
@@ -28,7 +28,11 @@ void dd::Systems::PadSystem::Initialize()
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EContactPowerUp, &PadSystem::OnContactPowerUp);
|
EVENT_SUBSCRIBE_MEMBER(m_EContactPowerUp, &PadSystem::OnContactPowerUp);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &PadSystem::OnStageCleared);
|
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &PadSystem::OnStageCleared);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EResetBall, &PadSystem::OnResetBall);
|
EVENT_SUBSCRIBE_MEMBER(m_EResetBall, &PadSystem::OnResetBall);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EResetAll, &PadSystem::OnResetAll);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_ERaiseWater, &PadSystem::OnRaiseWater);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_ERaiseWaterWall, &PadSystem::OnRaiseWaterWall);
|
||||||
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_EKrakenAttack, &PadSystem::OnKrakenAttack);
|
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &PadSystem::OnKrakenAttack);
|
||||||
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);
|
||||||
@@ -47,7 +51,6 @@ void dd::Systems::PadSystem::Initialize()
|
|||||||
physics->Category = CollisionLayer::Type::Pad;
|
physics->Category = CollisionLayer::Type::Pad;
|
||||||
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::PowerUp | CollisionLayer::LifeBuoy);
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::PowerUp | CollisionLayer::LifeBuoy);
|
||||||
physics->Calculate = true;
|
physics->Calculate = true;
|
||||||
ctransform->Sticky = true;
|
|
||||||
auto cModel = m_World->AddComponent<Components::Model>(ent);
|
auto cModel = m_World->AddComponent<Components::Model>(ent);
|
||||||
cModel->ModelFile = "Models/Ship/Ship.obj";
|
cModel->ModelFile = "Models/Ship/Ship.obj";
|
||||||
|
|
||||||
@@ -72,6 +75,17 @@ void dd::Systems::PadSystem::Initialize()
|
|||||||
|
|
||||||
m_StickTransform = transform;
|
m_StickTransform = transform;
|
||||||
m_StickyAim = sticky;
|
m_StickyAim = sticky;
|
||||||
|
|
||||||
|
/*{
|
||||||
|
auto entChild = m_World->CreateEntity(ent);
|
||||||
|
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(entChild);
|
||||||
|
transform->Position = glm::vec3(0.f, 12.5f, 0.f);
|
||||||
|
|
||||||
|
transform->Scale = glm::vec3(0.1f, 25.f, 0.1f);
|
||||||
|
std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(entChild);
|
||||||
|
sprite->SpriteFile = "Models/Brick/White.png";
|
||||||
|
sprite->Color = glm::vec4(0.f, 0.5f, 0.f, 0.5f);
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ResetBall = true;
|
m_ResetBall = true;
|
||||||
@@ -79,6 +93,10 @@ void dd::Systems::PadSystem::Initialize()
|
|||||||
|
|
||||||
void dd::Systems::PadSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
void dd::Systems::PadSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||||
{
|
{
|
||||||
|
if (m_Pause) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
||||||
if (templateCheck != nullptr){ return; }
|
if (templateCheck != nullptr){ return; }
|
||||||
|
|
||||||
@@ -175,18 +193,24 @@ void dd::Systems::PadSystem::Update(double dt)
|
|||||||
|
|
||||||
bool dd::Systems::PadSystem::OnPause(const dd::Events::Pause &event)
|
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;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
m_Pause = true;
|
||||||
|
|
||||||
if (IsPaused()) {
|
|
||||||
SetPause(false);
|
|
||||||
} else {
|
|
||||||
SetPause(true);
|
|
||||||
}
|
|
||||||
return 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) {
|
bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) {
|
||||||
int val = event.KeyCode;
|
int val = event.KeyCode;
|
||||||
if (val == GLFW_KEY_UP) {
|
if (val == GLFW_KEY_UP) {
|
||||||
@@ -204,14 +228,33 @@ bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) {
|
|||||||
} else if (val == GLFW_KEY_R) {
|
} else if (val == GLFW_KEY_R) {
|
||||||
Events::ResetBall e;
|
Events::ResetBall e;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
} else if (val == GLFW_KEY_M) {
|
} else if (val == GLFW_KEY_W) {
|
||||||
|
Events::RaiseWater e;
|
||||||
|
e.Amount = 0.2;
|
||||||
|
e.Speed = 0.2;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
} else if (val == GLFW_KEY_Q) {
|
||||||
|
Events::RaiseWaterWall e;
|
||||||
|
e.Amount = 0.2;
|
||||||
|
e.Speed = 0.2;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
} else if (val == GLFW_KEY_A) {
|
||||||
|
Events::ResetAll e;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
} else if (val == GLFW_KEY_M) {
|
||||||
Events::MultiBall e;
|
Events::MultiBall e;
|
||||||
e.padTransform = Transform();
|
e.padTransform = Transform();
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
} else if (val == GLFW_KEY_P) {
|
} else if (val == GLFW_KEY_P) {
|
||||||
Events::Pause e;
|
if (IsPaused()) {
|
||||||
e.Type = "All";
|
Events::Resume e;
|
||||||
EventBroker->Publish(e);
|
e.Type = "All";
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
} else {
|
||||||
|
Events::Pause e;
|
||||||
|
e.Type = "All";
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
}
|
||||||
} else if (val == GLFW_KEY_H) {
|
} else if (val == GLFW_KEY_H) {
|
||||||
Events::HitLag e;
|
Events::HitLag e;
|
||||||
e.Time = 0.2;
|
e.Time = 0.2;
|
||||||
@@ -226,22 +269,38 @@ bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) {
|
|||||||
e.Time = 3;
|
e.Time = 3;
|
||||||
e.TimeTakenToCoolDown = 10;
|
e.TimeTakenToCoolDown = 10;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
|
} else if (val == GLFW_KEY_G) {
|
||||||
|
Events::BrickGenerating e;
|
||||||
|
e.Origin = glm::vec3(-5, 7, -10);
|
||||||
|
e.Set = 1;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
} else if (val == GLFW_KEY_L) {
|
||||||
|
Events::Lifebuoy e;
|
||||||
|
e.Transform = Transform();
|
||||||
|
EventBroker->Publish(e);
|
||||||
} else if (val == GLFW_KEY_Y) {
|
} else if (val == GLFW_KEY_Y) {
|
||||||
Events::StickyPad e;
|
Events::StickyPad e;
|
||||||
|
e.Times = 3;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
}
|
} else if (val == GLFW_KEY_I) {
|
||||||
else if (val == GLFW_KEY_I) {
|
|
||||||
Events::InkBlaster e;
|
Events::InkBlaster e;
|
||||||
|
e.Shots = 5;
|
||||||
|
e.Speed = 7;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
}
|
} else if (val == GLFW_KEY_K) {
|
||||||
else if (val == GLFW_KEY_K) {
|
|
||||||
Events::KrakenAttack e;
|
Events::KrakenAttack e;
|
||||||
e.ChargeUpdate = 0;
|
e.ChargeUpdate = 0;
|
||||||
e.KrakenStrength = 0.1;
|
e.KrakenStrength = 0.1;
|
||||||
e.PlayerStrength = 0.05;
|
e.PlayerStrength = 0.05;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
}
|
} else if (val == GLFW_KEY_Q) {
|
||||||
else if (val == GLFW_KEY_SPACE) {
|
Events::Move e;
|
||||||
|
e.Entity = Entity();
|
||||||
|
e.GoalPosition = glm::vec3(0, 0, -10);
|
||||||
|
e.Speed = 5;
|
||||||
|
e.Queue = false;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
} else if (val == GLFW_KEY_SPACE) {
|
||||||
Events::ActionButton e;
|
Events::ActionButton e;
|
||||||
e.Position = Transform()->Position;
|
e.Position = Transform()->Position;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
@@ -369,6 +428,39 @@ bool dd::Systems::PadSystem::OnResetBall(const dd::Events::ResetBall &event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::PadSystem::OnResetAll(const dd::Events::ResetAll &event)
|
||||||
|
{
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::PadSystem::OnRaiseWater(const dd::Events::RaiseWater &event)
|
||||||
|
{
|
||||||
|
RaisePad(event.Amount, event.Speed);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::PadSystem::OnRaiseWaterWall(const dd::Events::RaiseWaterWall &event)
|
||||||
|
{
|
||||||
|
RaisePad(event.Amount, event.Speed);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::PadSystem::RaisePad(float amount, float speed)
|
||||||
|
{
|
||||||
|
auto transform = Transform();
|
||||||
|
glm::vec3 raise = glm::vec3(0, amount, 0);
|
||||||
|
Events::Move e;
|
||||||
|
e.Entity = m_Entity;
|
||||||
|
e.GoalPosition = transform->Position + raise;
|
||||||
|
e.Speed = speed;
|
||||||
|
e.Queue = true;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool dd::Systems::PadSystem::OnKrakenAttack(const dd::Events::KrakenAttack &event)
|
bool dd::Systems::PadSystem::OnKrakenAttack(const dd::Events::KrakenAttack &event)
|
||||||
{
|
{
|
||||||
if (!m_KrakenAttack) {
|
if (!m_KrakenAttack) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ void dd::Systems::ProjectileSystem::Initialize()
|
|||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EContact, &ProjectileSystem::OnContact);
|
EVENT_SUBSCRIBE_MEMBER(m_EContact, &ProjectileSystem::OnContact);
|
||||||
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_EInkBlaster, &ProjectileSystem::OnInkBlaster);
|
EVENT_SUBSCRIBE_MEMBER(m_EInkBlaster, &ProjectileSystem::OnInkBlaster);
|
||||||
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);
|
||||||
@@ -29,11 +30,12 @@ void dd::Systems::ProjectileSystem::Initialize()
|
|||||||
physics->Category = CollisionLayer::Type::Projectile;
|
physics->Category = CollisionLayer::Type::Projectile;
|
||||||
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Type::Pad | CollisionLayer::Type::Brick | CollisionLayer::Type::Wall);
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Type::Pad | CollisionLayer::Type::Brick | CollisionLayer::Type::Wall);
|
||||||
physics->Calculate = true;
|
physics->Calculate = true;
|
||||||
ctransform->Sticky = true;
|
|
||||||
ctransform->Position = glm::vec3(0.f, 0.f, -10.f);
|
ctransform->Position = glm::vec3(0.f, 0.f, -10.f);
|
||||||
ctransform->Scale = glm::vec3(0.1f, 0.1f, 0.1f);
|
ctransform->Scale = glm::vec3(0.6f, 0.6f, 0.6f);
|
||||||
auto cModel = m_World->AddComponent<Components::Model>(ent);
|
// auto cModel = m_World->AddComponent<Components::Model>(ent);
|
||||||
cModel->ModelFile = "Models/Test/Ball/Sid.obj";
|
// cModel->ModelFile = "Models/Test/Ball/Sid.obj";
|
||||||
|
auto cSprite = m_World->AddComponent<Components::Sprite>(ent);
|
||||||
|
cSprite->SpriteFile = "Textures/Particles/OilShot.png";
|
||||||
auto projectile = m_World->AddComponent<Components::Projectile>(ent);
|
auto projectile = m_World->AddComponent<Components::Projectile>(ent);
|
||||||
|
|
||||||
m_World->CommitEntity(ent);
|
m_World->CommitEntity(ent);
|
||||||
@@ -46,7 +48,9 @@ void dd::Systems::ProjectileSystem::Initialize()
|
|||||||
|
|
||||||
void dd::Systems::ProjectileSystem::Update(double dt)
|
void dd::Systems::ProjectileSystem::Update(double dt)
|
||||||
{
|
{
|
||||||
|
if (m_Pause) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dd::Systems::ProjectileSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
void dd::Systems::ProjectileSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||||
@@ -68,18 +72,23 @@ void dd::Systems::ProjectileSystem::UpdateEntity(double dt, EntityID entity, Ent
|
|||||||
|
|
||||||
bool dd::Systems::ProjectileSystem::OnPause(const dd::Events::Pause &event)
|
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;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
m_Pause = true;
|
||||||
|
|
||||||
if (IsPaused()) {
|
|
||||||
SetPause(false);
|
|
||||||
} else {
|
|
||||||
SetPause(true);
|
|
||||||
}
|
|
||||||
return 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)
|
bool dd::Systems::ProjectileSystem::OnContact(const dd::Events::Contact &event)
|
||||||
{
|
{
|
||||||
@@ -91,6 +100,7 @@ bool dd::Systems::ProjectileSystem::OnInkBlaster(const dd::Events::InkBlaster &e
|
|||||||
{
|
{
|
||||||
m_InkBlaster = true;
|
m_InkBlaster = true;
|
||||||
m_Shots = event.Shots;
|
m_Shots = event.Shots;
|
||||||
|
m_InkBlasterSpeed = event.Speed;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,9 +118,11 @@ bool dd::Systems::ProjectileSystem::OnActionButton(const dd::Events::ActionButto
|
|||||||
if (m_InkBlaster && m_SquidLoaded) {
|
if (m_InkBlaster && m_SquidLoaded) {
|
||||||
auto ent = m_World->CloneEntity(m_InkBlastTemplate);
|
auto ent = m_World->CloneEntity(m_InkBlastTemplate);
|
||||||
m_World->RemoveComponent<Components::Template>(ent);
|
m_World->RemoveComponent<Components::Template>(ent);
|
||||||
|
auto projectile = m_World->GetComponent<Components::Projectile>(ent);
|
||||||
|
projectile->Speed = m_InkBlasterSpeed;
|
||||||
auto transform = m_World->GetComponent<Components::Transform>(ent);
|
auto transform = m_World->GetComponent<Components::Transform>(ent);
|
||||||
transform->Position = event.Position;
|
transform->Position = event.Position;
|
||||||
transform->Velocity = glm::vec3(0, 5, 0);
|
transform->Velocity = glm::vec3(0, projectile->Speed, 0);
|
||||||
m_Shots--;
|
m_Shots--;
|
||||||
if (m_Shots <= 0) {
|
if (m_Shots <= 0) {
|
||||||
auto ball = m_World->GetComponent<Components::Ball>(m_AttachedSquid);
|
auto ball = m_World->GetComponent<Components::Ball>(m_AttachedSquid);
|
||||||
|
|||||||
@@ -0,0 +1,151 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-08.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "PrecompiledHeader.h"
|
||||||
|
#include "Game/ProjectileSystem.h"
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
//Ink Blast
|
||||||
|
{
|
||||||
|
auto ent = m_World->CreateEntity();
|
||||||
|
m_World->SetProperty(ent, "Name", "Projectile");
|
||||||
|
std::shared_ptr<Components::Transform> ctransform = m_World->AddComponent<Components::Transform>(ent);
|
||||||
|
|
||||||
|
auto circleShape = m_World->AddComponent<Components::CircleShape>(ent);
|
||||||
|
auto inkBlastTemplate = m_World->AddComponent<Components::Template>(ent);
|
||||||
|
circleShape->Radius = 0.1f;
|
||||||
|
auto physics = m_World->AddComponent<Components::Physics>(ent);
|
||||||
|
physics->CollisionType = CollisionType::Type::Dynamic;
|
||||||
|
physics->Category = CollisionLayer::Type::Projectile;
|
||||||
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Type::Pad | CollisionLayer::Type::Brick | CollisionLayer::Type::Wall);
|
||||||
|
physics->Calculate = true;
|
||||||
|
ctransform->Position = glm::vec3(0.f, 0.f, -10.f);
|
||||||
|
ctransform->Scale = glm::vec3(0.6f, 0.6f, 0.6f);
|
||||||
|
// auto cModel = m_World->AddComponent<Components::Model>(ent);
|
||||||
|
// cModel->ModelFile = "Models/Test/Ball/Sid.obj";
|
||||||
|
auto cSprite = m_World->AddComponent<Components::Sprite>(ent);
|
||||||
|
cSprite->SpriteFile = "Textures/Particles/OilShot.png";
|
||||||
|
auto projectile = m_World->AddComponent<Components::Projectile>(ent);
|
||||||
|
|
||||||
|
m_World->CommitEntity(ent);
|
||||||
|
|
||||||
|
m_InkBlastTemplate = ent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dd::Systems::ProjectileSystem::Update(double dt)
|
||||||
|
{
|
||||||
|
if (m_Pause) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dd::Systems::ProjectileSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||||
|
{
|
||||||
|
if (IsPaused()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
||||||
|
if (templateCheck != nullptr){ return; }
|
||||||
|
|
||||||
|
auto shot = m_World->GetComponent<Components::Projectile>(entity);
|
||||||
|
if (shot != nullptr) {
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
|
if (transform->Position.y > 8) {
|
||||||
|
m_World->RemoveEntity(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::ProjectileSystem::OnPause(const dd::Events::Pause &event)
|
||||||
|
{
|
||||||
|
/*if (event.Type != "ProjectileSystem" && event.Type != "All") {
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
m_Pause = 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)
|
||||||
|
{
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::ProjectileSystem::OnInkBlaster(const dd::Events::InkBlaster &event)
|
||||||
|
{
|
||||||
|
m_InkBlaster = true;
|
||||||
|
m_Shots = event.Shots;
|
||||||
|
m_InkBlasterSpeed = event.Speed;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::ProjectileSystem::OnHitPad(const dd::Events::HitPad &event)
|
||||||
|
{
|
||||||
|
if (m_InkBlaster) {
|
||||||
|
m_SquidLoaded = true;
|
||||||
|
m_AttachedSquid = event.Ball;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::ProjectileSystem::OnActionButton(const dd::Events::ActionButton &event)
|
||||||
|
{
|
||||||
|
if (m_InkBlaster && m_SquidLoaded) {
|
||||||
|
auto ent = m_World->CloneEntity(m_InkBlastTemplate);
|
||||||
|
m_World->RemoveComponent<Components::Template>(ent);
|
||||||
|
auto projectile = m_World->GetComponent<Components::Projectile>(ent);
|
||||||
|
projectile->Speed = m_InkBlasterSpeed;
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(ent);
|
||||||
|
transform->Position = event.Position;
|
||||||
|
<<<<<<< HEAD
|
||||||
|
transform->Velocity = glm::vec3(0, projectile->Speed, 0);
|
||||||
|
=======
|
||||||
|
transform->Velocity = glm::vec3(0, 7, 0);
|
||||||
|
>>>>>>> origin/master
|
||||||
|
m_Shots--;
|
||||||
|
if (m_Shots <= 0) {
|
||||||
|
auto ball = m_World->GetComponent<Components::Ball>(m_AttachedSquid);
|
||||||
|
m_InkBlaster = false;
|
||||||
|
m_SquidLoaded = false;
|
||||||
|
ball->InkBlaster = false;
|
||||||
|
ball->Sticky = false;
|
||||||
|
ball->Waiting = true;
|
||||||
|
|
||||||
|
{
|
||||||
|
Events::InkBlasterOver e;
|
||||||
|
e.Ball = m_AttachedSquid;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Events::ActionButton e;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-14.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "PrecompiledHeader.h"
|
||||||
|
#include "Game/ScreenShakeSystem.h"
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dd::Systems::ScreenShakeSystem::InitializeObjects()
|
||||||
|
{
|
||||||
|
m_Pause = false;
|
||||||
|
m_ScreenShake = false;
|
||||||
|
m_ShakeIntensity = 0;
|
||||||
|
m_CameraPosition = glm::vec3(0, 0, 0);
|
||||||
|
m_ShakeRepresentativeIntensity = 0;
|
||||||
|
m_ShakeTimer = 0;
|
||||||
|
m_ShakeEndTime = 0;
|
||||||
|
m_TimeTakenToCoolDown = 0;
|
||||||
|
m_CoolerMultiplier = 0;
|
||||||
|
m_Random = glm::vec3(0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dd::Systems::ScreenShakeSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||||
|
{
|
||||||
|
if (IsPaused()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*auto camera = m_World->GetComponent<Components::Camera>(entity);
|
||||||
|
|
||||||
|
if (camera != nullptr) {
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
|
|
||||||
|
if (m_ScreenShake) {
|
||||||
|
m_CameraPosition = transform->Position - m_Random;
|
||||||
|
|
||||||
|
m_ShakeTimer += dt;
|
||||||
|
if (m_ShakeTimer >= m_ShakeEndTime) {
|
||||||
|
//std::cout << "Used: " << m_ShakeIntensity << " True: " << m_ShakeRepresentativeIntensity << std::endl;
|
||||||
|
m_ShakeRepresentativeIntensity -= m_ShakeRepresentativeIntensity * m_CoolerMultiplier * dt;
|
||||||
|
m_ShakeIntensity = m_ShakeRepresentativeIntensity;
|
||||||
|
if (m_ShakeIntensity <= 0) {
|
||||||
|
m_ScreenShake = false;
|
||||||
|
transform->Position = glm::vec3(0, 0, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//std::cout << "Timer: " << m_ShakeTimer << " End: " << m_ShakeEndTime << std::endl;
|
||||||
|
}
|
||||||
|
std::uniform_real_distribution<float> dist(-m_ShakeIntensity, m_ShakeIntensity);
|
||||||
|
//float impulseStrength = dist(m_RandomGenerator);
|
||||||
|
m_Random.x = dist(m_RandomGenerator) / 20;
|
||||||
|
m_Random.y = dist(m_RandomGenerator) / 20;
|
||||||
|
|
||||||
|
//float half = m_ShakeIntensity / 2;
|
||||||
|
|
||||||
|
//m_Random.x = (m_Random.x - half) / 20;
|
||||||
|
//m_Random.y = (m_Random.y - half) / 20;
|
||||||
|
|
||||||
|
//std::cout << "X: " << randomX << " Y: " << randomY << std::endl;
|
||||||
|
transform->Position = glm::vec3(m_Random);
|
||||||
|
} else {
|
||||||
|
m_CameraPosition = transform->Position;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::ScreenShakeSystem::OnPause(const dd::Events::Pause &event)
|
||||||
|
{
|
||||||
|
/*if (event.Type != "ScreenShakeSystem" && event.Type != "All") {
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
m_ScreenShake = true;
|
||||||
|
m_ShakeIntensity = event.Intensity;
|
||||||
|
m_ShakeRepresentativeIntensity = event.Intensity;
|
||||||
|
m_ShakeEndTime = event.Time;
|
||||||
|
m_ShakeTimer = 0;
|
||||||
|
m_TimeTakenToCoolDown = event.TimeTakenToCoolDown;
|
||||||
|
m_CoolerMultiplier = m_ShakeIntensity / m_TimeTakenToCoolDown;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
void dd::Systems::TravellingSystem::Initialize()
|
void dd::Systems::TravellingSystem::Initialize()
|
||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &TravellingSystem::OnPause);
|
EVENT_SUBSCRIBE_MEMBER(m_EPause, &TravellingSystem::OnPause);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EResume, &TravellingSystem::OnResume);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &TravellingSystem::OnStageCleared);
|
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &TravellingSystem::OnStageCleared);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,7 +18,7 @@ void dd::Systems::TravellingSystem::Update(double dt)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_Travelling) {
|
if (m_Travelling) {
|
||||||
if (m_DistanceTravelled > 12.f) {
|
if (m_DistanceTravelled > 12.f) { //NextLevelDistance
|
||||||
m_DistanceTravelled = 0;
|
m_DistanceTravelled = 0;
|
||||||
m_Travelling = false;
|
m_Travelling = false;
|
||||||
Events::ArrivedAtNewStage e;
|
Events::ArrivedAtNewStage e;
|
||||||
@@ -30,37 +31,80 @@ void dd::Systems::TravellingSystem::Update(double dt)
|
|||||||
|
|
||||||
void dd::Systems::TravellingSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
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; }
|
||||||
|
|
||||||
if (m_Travelling) {
|
if (m_Travelling) {
|
||||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
auto travels = m_World->GetComponent<Components::Travels>(entity);
|
||||||
if (transform != nullptr) {
|
if (travels != nullptr) {
|
||||||
if (!transform->Sticky) {
|
if (!travels->CurrentlyTraveling) {
|
||||||
transform->Position.y -= 6.0f * dt;
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
|
if (transform != nullptr) {
|
||||||
|
Events::Move e;
|
||||||
|
e.Entity = entity;
|
||||||
|
glm::vec3 position = transform->Position;
|
||||||
|
glm::vec3 goalPosition = position;
|
||||||
|
e.Queue = false;
|
||||||
|
e.Speed = 6;
|
||||||
|
goalPosition.y -= 12; //NextLevelDistance
|
||||||
|
if (goalPosition.y < -34.6) { //Halfpipe Value
|
||||||
|
auto background = m_World->GetComponent<Components::Background>(entity);
|
||||||
|
if (background != nullptr) {
|
||||||
|
float yValue = position.y; // A negative value between -34.6 and -22.6;
|
||||||
|
yValue += 22.6; // A positive value between -12 and 0. The distance it should travel from 34.6;
|
||||||
|
background->distanceLeftToCorrectTravelPosition = yValue;
|
||||||
|
} else {
|
||||||
|
m_World->RemoveEntity(entity);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e.GoalPosition = goalPosition;
|
||||||
|
|
||||||
|
travels->CurrentlyTraveling = true;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
//transform->Position.y -= 6.0f * dt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
transform->Position.y -= 6.0f * dt;
|
auto travels = m_World->GetComponent<Components::Travels>(entity);
|
||||||
|
if (travels != nullptr) {
|
||||||
|
travels->CurrentlyTraveling = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dd::Systems::TravellingSystem::OnPause(const dd::Events::Pause &event)
|
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;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
m_Pause = true;
|
||||||
if (IsPaused()) {
|
|
||||||
SetPause(false);
|
|
||||||
} else {
|
|
||||||
SetPause(true);
|
|
||||||
}
|
|
||||||
return 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)
|
bool dd::Systems::TravellingSystem::OnStageCleared(const dd::Events::StageCleared &event)
|
||||||
{
|
{
|
||||||
if (event.ClearedStage < 5) {
|
if (event.ClearedStage < event.StagesInCluster) {
|
||||||
m_Travelling = true;
|
m_Travelling = true;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::TravellingSystem::OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event)
|
||||||
|
{
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-10-20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "PrecompiledHeader.h"
|
||||||
|
#include "Game/WaterSystem.h"
|
||||||
|
|
||||||
|
void dd::Systems::WaterSystem::Initialize()
|
||||||
|
{
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EPause, &WaterSystem::OnPause);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EResume, &WaterSystem::OnResume);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_ERelevantObjectCreated, &WaterSystem::OnRelevantObjectCreated);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &WaterSystem::OnStageCleared);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_ERaiseWater, &WaterSystem::OnRaiseWater);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_ERaiseWaterWall, &WaterSystem::OnRaiseWaterWall);
|
||||||
|
|
||||||
|
//Water test
|
||||||
|
{
|
||||||
|
auto t_waterBody = m_World->CreateEntity();
|
||||||
|
auto transform = m_World->AddComponent<Components::Transform>(t_waterBody);
|
||||||
|
transform->Position = glm::vec3(0.f, -3.5f, -10.f);
|
||||||
|
transform->Scale = glm::vec3(7.0f, 1.5f, 1.f);
|
||||||
|
auto water = m_World->AddComponent<Components::WaterVolume>(t_waterBody);
|
||||||
|
auto body = m_World->AddComponent<Components::RectangleShape>(t_waterBody);
|
||||||
|
m_World->CommitEntity(t_waterBody);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dd::Systems::WaterSystem::Update(double dt)
|
||||||
|
{
|
||||||
|
if (m_Pause) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void dd::Systems::WaterSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||||
|
{
|
||||||
|
if (m_Pause) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
||||||
|
if (templateCheck != nullptr){ return; }
|
||||||
|
|
||||||
|
if (m_BottomWall == 0) {
|
||||||
|
for (auto it = m_World->GetEntities()->begin(); it != m_World->GetEntities()->end(); it++) {
|
||||||
|
if (m_World->GetProperty<std::string>(it->first, "Name") == "BottomWall") {
|
||||||
|
m_BottomWall = entity;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::WaterSystem::OnPause(const dd::Events::Pause &event)
|
||||||
|
{
|
||||||
|
/*if (event.Type != "WaterSystem" && event.Type != "All") {
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
m_Pause = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool dd::Systems::WaterSystem::OnResume(const dd::Events::Resume &event)
|
||||||
|
{
|
||||||
|
/*if (event.Type != "WaterSystem" && event.Type != "All") {
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
m_Pause = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::WaterSystem::OnRelevantObjectCreated(const dd::Events::RelevantObjectCreated &event)
|
||||||
|
{
|
||||||
|
if (event.ObjectName == "BottomWall") {
|
||||||
|
m_BottomWall = event.ObjectID;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::WaterSystem::OnStageCleared(const dd::Events::StageCleared &event)
|
||||||
|
{
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::WaterSystem::OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event)
|
||||||
|
{
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::WaterSystem::OnRaiseWater(const dd::Events::RaiseWater &event)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
auto t_waterBody = m_World->CreateEntity();
|
||||||
|
auto transform = m_World->AddComponent<Components::Transform>(t_waterBody);
|
||||||
|
transform->Position = glm::vec3(0.f, -3.5f, -10.f);
|
||||||
|
transform->Scale = glm::vec3(7.0f, event.Amount * 1.6f, 1.f);
|
||||||
|
auto water = m_World->AddComponent<Components::WaterVolume>(t_waterBody);
|
||||||
|
auto body = m_World->AddComponent<Components::RectangleShape>(t_waterBody);
|
||||||
|
m_World->CommitEntity(t_waterBody);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::WaterSystem::OnRaiseWaterWall(const dd::Events::RaiseWaterWall &event)
|
||||||
|
{
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(m_BottomWall);
|
||||||
|
if (transform != nullptr) {
|
||||||
|
glm::vec3 raise = glm::vec3(0, event.Amount, 0);
|
||||||
|
Events::Move e;
|
||||||
|
e.Entity = m_BottomWall;
|
||||||
|
e.GoalPosition = transform->Position + raise;
|
||||||
|
e.Queue = true;
|
||||||
|
e.Speed = 0.2;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
} else {
|
||||||
|
LOG_ERROR("There is no BottomWall in WaterSystem");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -23,13 +23,14 @@ void dd::Systems::PhysicsSystem::Initialize()
|
|||||||
InitializeWater();
|
InitializeWater();
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_SetImpulse, &PhysicsSystem::SetImpulse);
|
EVENT_SUBSCRIBE_MEMBER(m_SetImpulse, &PhysicsSystem::SetImpulse);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &PhysicsSystem::OnPause);
|
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_ECreateParticleSequence, &PhysicsSystem::CreateParticleSequence);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EContact, &PhysicsSystem::OnContact);
|
EVENT_SUBSCRIBE_MEMBER(m_EContact, &PhysicsSystem::OnContact);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dd::Systems::PhysicsSystem::InitializeWater()
|
void dd::Systems::PhysicsSystem::InitializeWater()
|
||||||
{
|
{
|
||||||
float radius = 0.13f;
|
float radius = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<float>("Water.Radius", 0.2f);
|
||||||
float gravityScale = 1.0f;
|
float gravityScale = 1.0f;
|
||||||
|
|
||||||
b2ParticleSystemDef m_ParticleSystemDef;
|
b2ParticleSystemDef m_ParticleSystemDef;
|
||||||
@@ -244,6 +245,10 @@ void dd::Systems::PhysicsSystem::Update(double dt)
|
|||||||
|
|
||||||
void dd::Systems::PhysicsSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
void dd::Systems::PhysicsSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||||
{
|
{
|
||||||
|
if (m_Pause) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto particle = m_World->GetComponent<Components::Particle>(entity);
|
auto particle = m_World->GetComponent<Components::Particle>(entity);
|
||||||
auto pTemplate = m_World->GetComponent<Components::Template>(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)
|
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;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
m_Pause = true;
|
||||||
if (m_Pause) {
|
|
||||||
m_Pause = false;
|
|
||||||
} else {
|
|
||||||
m_Pause = true;
|
|
||||||
}
|
|
||||||
return 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)
|
void dd::Systems::PhysicsSystem::OnEntityCommit(EntityID entity)
|
||||||
{
|
{
|
||||||
auto physicsComponent = m_World->GetComponent<Components::Physics>(entity);
|
auto physicsComponent = m_World->GetComponent<Components::Physics>(entity);
|
||||||
@@ -477,6 +486,7 @@ void dd::Systems::PhysicsSystem::CreateParticleGroup(EntityID e)
|
|||||||
|
|
||||||
transformChild->Position = glm::vec3(t_ParticlePositions[i].x - transform->Position.x, t_ParticlePositions[i].y - transform->Position.y, -9.5f);
|
transformChild->Position = glm::vec3(t_ParticlePositions[i].x - transform->Position.x, t_ParticlePositions[i].y - transform->Position.y, -9.5f);
|
||||||
transformChild->Scale = glm::vec3(m_WaterParticleSystem->GetRadius())/transform->Scale;
|
transformChild->Scale = glm::vec3(m_WaterParticleSystem->GetRadius())/transform->Scale;
|
||||||
|
transformChild->Scale *= 2;
|
||||||
m_World->CommitEntity(t_waterparticle);
|
m_World->CommitEntity(t_waterparticle);
|
||||||
|
|
||||||
m_EntitiesToWaterParticleHandle.insert(std::make_pair(t_waterparticle, m_WaterParticleSystem->GetParticleHandleFromIndex(i)));
|
m_EntitiesToWaterParticleHandle.insert(std::make_pair(t_waterparticle, m_WaterParticleSystem->GetParticleHandleFromIndex(i)));
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ void dd::Systems::AnimationSystem::RegisterComponents(ComponentFactory* cf)
|
|||||||
void dd::Systems::AnimationSystem::Initialize()
|
void dd::Systems::AnimationSystem::Initialize()
|
||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &AnimationSystem::OnPause);
|
EVENT_SUBSCRIBE_MEMBER(m_EPause, &AnimationSystem::OnPause);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EResume, &AnimationSystem::OnResume);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dd::Systems::AnimationSystem::Update(double dt)
|
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)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,8 @@ void dd::Renderer::CreateBuffers()
|
|||||||
m_ErrorTexture = ResourceManager::Load<Texture>("Textures/Core/ErrorTexture.png");
|
m_ErrorTexture = ResourceManager::Load<Texture>("Textures/Core/ErrorTexture.png");
|
||||||
m_StandardNormal = ResourceManager::Load<Texture>("Textures/Core/NeutralNormalMap.png");
|
m_StandardNormal = ResourceManager::Load<Texture>("Textures/Core/NeutralNormalMap.png");
|
||||||
m_StandardSpecular = ResourceManager::Load<Texture>("Textures/Core/NeutralSpecularMap.png");
|
m_StandardSpecular = ResourceManager::Load<Texture>("Textures/Core/NeutralSpecularMap.png");
|
||||||
m_WhiteSphereTexture = ResourceManager::Load<Texture>("Textures/Test/Water.png");
|
//m_WhiteSphereTexture = ResourceManager::Load<Texture>("Textures/Test/Water.png");
|
||||||
|
m_WhiteSphereTexture = ResourceManager::Load<Texture>("Textures/Particles/FadeBall.png");
|
||||||
|
|
||||||
glGenRenderbuffers(1, &m_RbDepthBuffer);
|
glGenRenderbuffers(1, &m_RbDepthBuffer);
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, m_RbDepthBuffer);
|
glBindRenderbuffer(GL_RENDERBUFFER, m_RbDepthBuffer);
|
||||||
@@ -208,8 +209,8 @@ void dd::Renderer::CreateBuffers()
|
|||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_Resolution.Width, m_Resolution.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_Resolution.Width, m_Resolution.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
|
||||||
//Fill water pass
|
//Fill water pass
|
||||||
glGenFramebuffers(1, &m_FbWater);
|
glGenFramebuffers(1, &m_FbWater);
|
||||||
@@ -564,7 +565,9 @@ void dd::Renderer::DrawWater(RenderQueue &rq)
|
|||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
m_SpWater2->Bind();
|
m_SpWater2->Bind();
|
||||||
//TODO: Add this in water particle component. Blurradius
|
//TODO: Add this in water particle component. Blurradius
|
||||||
float radius = 3.f;
|
|
||||||
|
float radius = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<float>("Water.Radius", 0.2f);
|
||||||
|
radius *= 35;
|
||||||
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderProgramHandle, "dir"), 1, glm::value_ptr(glm::vec2(1.0f, 0.0f)));
|
glUniform2fv(glGetUniformLocation(shaderProgramHandle, "dir"), 1, glm::value_ptr(glm::vec2(1.0f, 0.0f)));
|
||||||
glUniform1f(glGetUniformLocation(shaderProgramHandle, "res"), m_Resolution.Width);
|
glUniform1f(glGetUniformLocation(shaderProgramHandle, "res"), m_Resolution.Width);
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ dd::Sound::Sound(std::string path)
|
|||||||
m_Path = path;
|
m_Path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dd::Sound::~Sound()
|
||||||
|
{
|
||||||
|
alDeleteBuffers(1, &m_Buffer);
|
||||||
|
}
|
||||||
|
|
||||||
ALuint dd::Sound::LoadFile(std::string path)
|
ALuint dd::Sound::LoadFile(std::string path)
|
||||||
{
|
{
|
||||||
if (m_BufferCache.find(path) != m_BufferCache.end()) {
|
if (m_BufferCache.find(path) != m_BufferCache.end()) {
|
||||||
|
|||||||
@@ -3,6 +3,19 @@
|
|||||||
|
|
||||||
dd::Systems::SoundSystem::~SoundSystem()
|
dd::Systems::SoundSystem::~SoundSystem()
|
||||||
{
|
{
|
||||||
|
for (auto &bgm : m_BGMSourcesToBuffers) {
|
||||||
|
alSourceStop(bgm.first);
|
||||||
|
alDeleteSources(1, &bgm.first);
|
||||||
|
//bgm.second->~Sound();
|
||||||
|
}
|
||||||
|
for (auto &sfx : m_SFXSourcesToBuffers) {
|
||||||
|
alSourceStop(sfx.first);
|
||||||
|
alDeleteSources(1, &sfx.first);
|
||||||
|
//sfx.second->~Sound();
|
||||||
|
}
|
||||||
|
m_BGMSourcesToBuffers.clear();
|
||||||
|
m_SFXSourcesToBuffers.clear();
|
||||||
|
alcDestroyContext(m_Context);
|
||||||
alcCloseDevice(m_Device);
|
alcCloseDevice(m_Device);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10,42 +23,33 @@ void dd::Systems::SoundSystem::Initialize()
|
|||||||
{
|
{
|
||||||
//initialize OpenAL
|
//initialize OpenAL
|
||||||
m_Device = alcOpenDevice(NULL);
|
m_Device = alcOpenDevice(NULL);
|
||||||
ALCcontext* context;
|
|
||||||
|
|
||||||
if (m_Device) {
|
if (m_Device) {
|
||||||
context = alcCreateContext(m_Device, NULL);
|
m_Context = alcCreateContext(m_Device, NULL);
|
||||||
alcMakeContextCurrent(context);
|
alcMakeContextCurrent(m_Context);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG_ERROR("OpenAL failed to initialize.");
|
LOG_ERROR("OpenAL failed to initialize.");
|
||||||
}
|
}
|
||||||
alGetError();
|
//alGetError();
|
||||||
|
|
||||||
//Subscribe to events
|
//Subscribe to events
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EContact, &SoundSystem::OnContact);
|
EVENT_SUBSCRIBE_MEMBER(m_EContact, &SoundSystem::OnContact);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlaySFX, &SoundSystem::OnPlaySound);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlaySFX, &SoundSystem::OnPlaySound);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EStopSound, &SoundSystem::OnStopSound);
|
EVENT_SUBSCRIBE_MEMBER(m_EStopSound, &SoundSystem::OnStopSound);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EMasterVolume, &SoundSystem::OnMasterVolume);
|
EVENT_SUBSCRIBE_MEMBER(m_EMasterVolume, &SoundSystem::OnMasterVolume);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EGameStart, &SoundSystem::OnGameStart);
|
||||||
|
|
||||||
m_SFXMasterVolume = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<float>("Audio.SFXVolume", 1.f);
|
m_SFXMasterVolume = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<float>("Audio.SFXVolume", 1.f);
|
||||||
m_BGMMasterVolume = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<float>("Audio.BGMVolume", 1.f);
|
m_BGMMasterVolume = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<float>("Audio.BGMVolume", 1.f);
|
||||||
|
|
||||||
//Todo: Move this
|
//TODO: Move this
|
||||||
{
|
Events::PlaySound e;
|
||||||
dd::Events::PlaySound e;
|
e.FilePath = MENU_BGM;
|
||||||
e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav";
|
e.IsAmbient = true;
|
||||||
e.IsAmbient = true;
|
e.Gain = 0.2f;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
}
|
|
||||||
{
|
|
||||||
dd::Events::PlaySound e;
|
|
||||||
e.FilePath = "Sounds/BGM/water-flowing.wav";
|
|
||||||
e.Gain = 0.3f;
|
|
||||||
e.IsAmbient = true;
|
|
||||||
EventBroker->Publish(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dd::Systems::SoundSystem::Update(double dt)
|
void dd::Systems::SoundSystem::Update(double dt)
|
||||||
@@ -63,7 +67,6 @@ void dd::Systems::SoundSystem::Update(double dt)
|
|||||||
|
|
||||||
for (int i = 0; i < deleteList.size(); i++) {
|
for (int i = 0; i < deleteList.size(); i++) {
|
||||||
alDeleteSources(1, &deleteList[i]);
|
alDeleteSources(1, &deleteList[i]);
|
||||||
//alDeleteBuffers(1, &m_SourcesToBuffers[deleteList[i]]);
|
|
||||||
m_SFXSourcesToBuffers.erase(deleteList[i]);
|
m_SFXSourcesToBuffers.erase(deleteList[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,12 +121,13 @@ bool dd::Systems::SoundSystem::OnStopSound(const dd::Events::StopSound &event)
|
|||||||
{
|
{
|
||||||
if (item.second->Path() == event.FilePath) {
|
if (item.second->Path() == event.FilePath) {
|
||||||
itemToDeleted = item.first;
|
itemToDeleted = item.first;
|
||||||
break;
|
alSourceStop(itemToDeleted);
|
||||||
|
alDeleteSources(1, &itemToDeleted);
|
||||||
|
m_BGMSourcesToBuffers.erase(itemToDeleted);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
alSourceStop(itemToDeleted);
|
|
||||||
alDeleteSources(1, &itemToDeleted);
|
|
||||||
m_BGMSourcesToBuffers.erase(itemToDeleted);
|
|
||||||
|
|
||||||
//Should not happen because SFX's should be very short.
|
//Should not happen because SFX's should be very short.
|
||||||
for (auto item : m_SFXSourcesToBuffers)
|
for (auto item : m_SFXSourcesToBuffers)
|
||||||
@@ -175,11 +179,35 @@ bool dd::Systems::SoundSystem::OnContact(const dd::Events::Contact &event)
|
|||||||
dd::Events::PlaySound e;
|
dd::Events::PlaySound e;
|
||||||
e.FilePath = collisionSound->FilePath;
|
e.FilePath = collisionSound->FilePath;
|
||||||
e.IsAmbient = false;
|
e.IsAmbient = false;
|
||||||
|
e.Gain = 0.8f;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::SoundSystem::OnGameStart(const dd::Events::GameStart &event)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
dd::Events::StopSound e;
|
||||||
|
e.FilePath = MENU_BGM;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
dd::Events::PlaySound e;
|
||||||
|
e.FilePath = GAME_BGM;
|
||||||
|
e.IsAmbient = true;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
dd::Events::PlaySound e;
|
||||||
|
e.FilePath = WATER_BGM;
|
||||||
|
e.Gain = 0.3f;
|
||||||
|
e.IsAmbient = true;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,12 +20,125 @@
|
|||||||
#include "Transform/TransformSystem.h"
|
#include "Transform/TransformSystem.h"
|
||||||
#include "Core/World.h"
|
#include "Core/World.h"
|
||||||
|
|
||||||
|
void dd::Systems::TransformSystem::Initialize()
|
||||||
|
{
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EMove, &Systems::TransformSystem::OnMove);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_ERotate, &Systems::TransformSystem::OnRotate);
|
||||||
|
}
|
||||||
|
|
||||||
void dd::Systems::TransformSystem::Update(double dt)
|
void dd::Systems::TransformSystem::Update(double dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dd::Systems::TransformSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||||
|
{
|
||||||
|
if (m_MoveItems.find(entity) != m_MoveItems.end())
|
||||||
|
{
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
|
|
||||||
|
glm::vec3 direction = glm::normalize(m_MoveItems[entity].GoalPosition - transform->Position);
|
||||||
|
glm::vec3 movement = direction * m_MoveItems[entity].Speed * (float)dt;
|
||||||
|
|
||||||
|
glm::vec3 v1 = m_MoveItems[entity].GoalPosition - transform->Position;
|
||||||
|
glm::vec3 v2 = movement;
|
||||||
|
|
||||||
|
if (glm::length(v2) >= glm::length(v1))
|
||||||
|
{
|
||||||
|
transform->Position = m_MoveItems[entity].GoalPosition;
|
||||||
|
//transform->Velocity = glm::vec3(0, 0, 0);
|
||||||
|
|
||||||
|
m_MoveItems.erase(entity);
|
||||||
|
|
||||||
|
if (m_QueuedMoveItems.find(entity) != m_QueuedMoveItems.end())
|
||||||
|
{
|
||||||
|
auto it = m_QueuedMoveItems.find(entity);
|
||||||
|
m_MoveItems[entity] = it->second;
|
||||||
|
m_QueuedMoveItems.erase(it->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
transform->Position += movement;
|
||||||
|
//transform->Velocity = movement;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_RotationItems.find(entity) != m_RotationItems.end())
|
||||||
|
{
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
|
auto absolutetransform = AbsoluteTransform(entity);
|
||||||
|
|
||||||
|
float percentage = dt / m_RotationItems[entity].Time;
|
||||||
|
m_RotationItems[entity].Time -= dt;
|
||||||
|
glm::clamp(percentage, 0.f, 1.0f);
|
||||||
|
transform->Orientation = glm::slerp(transform->Orientation, m_RotationItems[entity].GoalRotation, percentage);
|
||||||
|
|
||||||
|
if (m_RotationItems[entity].Time <= 0)
|
||||||
|
{
|
||||||
|
m_RotationItems.erase(entity);
|
||||||
|
|
||||||
|
if (m_QueuedRotationItems.find(entity) != m_QueuedRotationItems.end())
|
||||||
|
{
|
||||||
|
auto it = m_QueuedRotationItems.find(entity);
|
||||||
|
m_RotationItems[entity] = it->second;
|
||||||
|
m_QueuedRotationItems.erase(it->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::TransformSystem::OnRotate(const Events::Rotate &event)
|
||||||
|
{
|
||||||
|
RotationItems item;
|
||||||
|
item.Entity = event.Entity;
|
||||||
|
item.GoalRotation = event.GoalRotation;
|
||||||
|
item.Time = event.Time;
|
||||||
|
|
||||||
|
if (event.Queue)
|
||||||
|
{
|
||||||
|
if (m_RotationItems.find(event.Entity) != m_RotationItems.end())
|
||||||
|
{
|
||||||
|
m_QueuedRotationItems.insert(std::make_pair(event.Entity, item));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_RotationItems[event.Entity] = item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_RotationItems[event.Entity] = item;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::TransformSystem::OnMove(const Events::Move &event)
|
||||||
|
{
|
||||||
|
MoveItems item;
|
||||||
|
item.Entity = event.Entity;
|
||||||
|
item.GoalPosition = event.GoalPosition;
|
||||||
|
item.Speed = event.Speed;
|
||||||
|
|
||||||
|
if (event.Queue)
|
||||||
|
{
|
||||||
|
if (m_MoveItems.find(event.Entity) != m_MoveItems.end())
|
||||||
|
{
|
||||||
|
m_QueuedMoveItems.insert(std::make_pair(event.Entity, item));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_MoveItems[event.Entity] = item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_MoveItems[event.Entity] = item;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 dd::Systems::TransformSystem::AbsolutePosition(EntityID entity)
|
glm::vec3 dd::Systems::TransformSystem::AbsolutePosition(EntityID entity)
|
||||||
{
|
{
|
||||||
glm::vec3 absPosition;
|
glm::vec3 absPosition;
|
||||||
|
|||||||
Reference in New Issue
Block a user