Merge branch 'master' of github.com:teamfisk/AgileBreakOut
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
[Debug]
|
||||
SkipStory=false
|
||||
LogLevel=1
|
||||
SkipPreload=false
|
||||
SkipMenu=false
|
||||
|
||||
[Audio]
|
||||
SFXVolume=0.5
|
||||
@@ -9,4 +10,10 @@ BGMVolume=0.5
|
||||
[Video]
|
||||
Fullscreen=false
|
||||
Width=675
|
||||
Height=1080[Water]Radius=0.3[Cheat]GodMode=false
|
||||
Height=1080
|
||||
|
||||
[Water]
|
||||
Radius=0.3
|
||||
|
||||
[Cheat]
|
||||
GodMode=false
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 31 KiB |
Binary file not shown.
+28
-4
@@ -34,9 +34,11 @@
|
||||
#include "CTemplate.h"
|
||||
#include "Core/ConfigFile.h"
|
||||
#include "Core/EventBroker.h"
|
||||
#include "Input/InputSystem.h"
|
||||
#include "Rendering/CModel.h"
|
||||
#include "Rendering/CSprite.h"
|
||||
#include "Rendering/CPointLight.h"
|
||||
#include "Rendering/CCamera.h"
|
||||
#include "Transform/TransformSystem.h"
|
||||
#include "Sound/SoundSystem.h"
|
||||
#include "Sound/CCollisionSound.h"
|
||||
@@ -67,6 +69,7 @@
|
||||
|
||||
#include "Game/BrickComponents.h"
|
||||
|
||||
#include "Game/ScreenShakeSystem.h"
|
||||
#include "Game/EScreenShake.h"
|
||||
|
||||
#include "Physics/PhysicsSystem.h"
|
||||
@@ -147,6 +150,7 @@ public:
|
||||
|
||||
m_World->ComponentFactory.Register<Components::Sprite>();
|
||||
|
||||
m_World->ComponentFactory.Register<Components::Camera>();
|
||||
m_World->ComponentFactory.Register<Components::RectangleShape>();
|
||||
m_World->ComponentFactory.Register<Components::Physics>();
|
||||
m_World->ComponentFactory.Register<Components::Ball>();
|
||||
@@ -173,6 +177,9 @@ public:
|
||||
m_World->ComponentFactory.Register<Components::InkBlasterBrick>();
|
||||
m_World->ComponentFactory.Register<Components::KrakenAttackBrick>();
|
||||
|
||||
//m_World->SystemFactory.Register<Systems::InputSystem>(
|
||||
// [this]() { return new Systems::InputSystem(m_World.get(), m_EventBroker); });
|
||||
//m_World->AddSystem<Systems::InputSystem>();
|
||||
m_World->SystemFactory.Register<Systems::LevelSystem>(
|
||||
[this]() { return new Systems::LevelSystem(m_World.get(), m_EventBroker); });
|
||||
m_World->AddSystem<Systems::LevelSystem>();
|
||||
@@ -209,6 +216,9 @@ public:
|
||||
m_World->SystemFactory.Register<Systems::LifeSystem>(
|
||||
[this]() { return new Systems::LifeSystem(m_World.get(), m_EventBroker); });
|
||||
m_World->AddSystem<Systems::LifeSystem>();
|
||||
m_World->SystemFactory.Register<Systems::ScreenShakeSystem>(
|
||||
[this]() { return new Systems::ScreenShakeSystem(m_World.get(), m_EventBroker); });
|
||||
m_World->AddSystem<Systems::ScreenShakeSystem>();
|
||||
|
||||
m_World->ComponentFactory.Register<Components::Model>();
|
||||
m_World->ComponentFactory.Register<Components::Template>();
|
||||
@@ -251,9 +261,10 @@ public:
|
||||
m_LastTime = currentTime;
|
||||
|
||||
// Update input
|
||||
m_EventBroker->Swap();
|
||||
m_InputManager->Update(dt);
|
||||
// Swap event queues to get fresh input data in the read queue
|
||||
//m_EventBroker->Swap();
|
||||
//m_EventBroker->Process<Systems::InputSystem>();
|
||||
m_EventBroker->Swap();
|
||||
|
||||
//ResourceManager::Update();
|
||||
if (m_GameIsRunning) {
|
||||
@@ -271,8 +282,6 @@ public:
|
||||
TEMPAddToRenderQueue();
|
||||
}
|
||||
|
||||
std::unique_ptr<dd::Camera> defaultCamera = nullptr;
|
||||
|
||||
// Render scene
|
||||
//TODO send renderqueue to draw.
|
||||
m_Renderer->Draw(m_RendererQueue);
|
||||
@@ -280,6 +289,7 @@ public:
|
||||
m_EventBroker->Process<Engine>();
|
||||
// Swap event queues
|
||||
m_EventBroker->Swap();
|
||||
m_EventBroker->Clear();
|
||||
|
||||
glfwPollEvents();
|
||||
}
|
||||
@@ -293,6 +303,20 @@ public:
|
||||
if (!m_TransformSystem)
|
||||
m_TransformSystem = m_World->GetSystem<Systems::TransformSystem>();
|
||||
|
||||
// HACK: How do we handle multiple cameras? Maybe view and projection matrices in render queue...
|
||||
auto cameras = m_World->GetComponentsOfType<Components::Camera>();
|
||||
if (cameras != nullptr) {
|
||||
for (auto& component : *cameras) {
|
||||
auto camera = static_cast<Components::Camera*>(component.get());
|
||||
auto transform = m_World->GetComponent<Components::Transform>(camera->Entity);
|
||||
m_Renderer->Camera()->SetPosition(transform->Position);
|
||||
m_Renderer->Camera()->SetOrientation(transform->Orientation);
|
||||
m_Renderer->Camera()->SetFOV(camera->FOV);
|
||||
m_Renderer->Camera()->SetNearClip(camera->NearClip);
|
||||
m_Renderer->Camera()->SetFarClip(camera->FarClip);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &pair : *m_World->GetEntities())
|
||||
{
|
||||
EntityID entity = pair.first;
|
||||
|
||||
@@ -121,6 +121,7 @@ public:
|
||||
int Process();
|
||||
int Process(std::string contextTypeName);
|
||||
void Swap();
|
||||
void Clear();
|
||||
void Unsubscribe(BaseEventRelay &relay);
|
||||
|
||||
private:
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "Physics/ECreateParticleSequence.h"
|
||||
#include "Sound/CCollisionSound.h"
|
||||
#include "Sound/EPlaySound.h"
|
||||
#include "Rendering/EAnimationComplete.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
@@ -145,6 +146,7 @@ private:
|
||||
dd::EventRelay<BallSystem, dd::Events::ActionButton> m_EActionButton;
|
||||
dd::EventRelay<BallSystem, dd::Events::StageCleared> m_EStageCleared;
|
||||
dd::EventRelay<BallSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage;
|
||||
dd::EventRelay<BallSystem, dd::Events::AnimationComplete> m_EAnimationComplete;
|
||||
|
||||
bool Contact(const Events::Contact &event);
|
||||
bool OnMultiBallLost(const dd::Events::MultiBallLost &event);
|
||||
@@ -160,6 +162,7 @@ private:
|
||||
bool OnActionButton(const dd::Events::ActionButton &event);
|
||||
bool OnStageCleared(const dd::Events::StageCleared &event);
|
||||
bool OnArrivedToNewStage(const dd::Events::ArrivedAtNewStage &event);
|
||||
bool OnAnimationComplete(const dd::Events::AnimationComplete &event);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ struct Ball : Component
|
||||
bool Waiting = true;
|
||||
bool InkBlaster = false;
|
||||
bool Sticky = false;
|
||||
bool Loaded = false;
|
||||
glm::vec3 StickyPlacement = glm::vec3(0, 0, 0);
|
||||
glm::vec3 SavedSpeed = glm::vec3(0, 1, 0);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Components
|
||||
|
||||
struct Kraken : Component {
|
||||
|
||||
int MaxHealth = 30;
|
||||
int MaxHealth = 18;
|
||||
int Health = MaxHealth;
|
||||
int CurrentAction = 3;
|
||||
float RetreatSpeed = 0.2;
|
||||
|
||||
@@ -20,6 +20,7 @@ struct BrickGenerating : Event
|
||||
int TargetLine;
|
||||
int Set;
|
||||
int SetCluster;
|
||||
int Speed = 6;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace Events
|
||||
|
||||
struct ScreenShake : Event
|
||||
{
|
||||
float Time;
|
||||
int Intensity;
|
||||
float TimeTakenToCoolDown;
|
||||
float Time = 1.f;
|
||||
float Intensity = 1.f;
|
||||
float TimeTakenToCoolDown = 1.f;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "Game/CKraken.h"
|
||||
#include "Game/CBall.h"
|
||||
#include "Game/CProjectile.h"
|
||||
#include "Game/EScreenShake.h"
|
||||
#include "Sound/CCollisionSound.h"
|
||||
#include "Rendering/CAnimation.h"
|
||||
#include "Rendering/CSprite.h"
|
||||
@@ -67,6 +68,7 @@ private:
|
||||
bool m_KrakenBattle = false;
|
||||
bool m_KrakenHasArrived = false;
|
||||
bool m_ReturnToIdle = false;
|
||||
bool m_RandomKraken = false;
|
||||
EntityID m_KrakenTemplate;
|
||||
std::string m_Action = "Idle";
|
||||
int m_NumberOfActions;
|
||||
@@ -76,6 +78,9 @@ private:
|
||||
float m_KrakenCurrentSecondsToAction = 15;
|
||||
const int Idle = 1;
|
||||
|
||||
int m_Set = 0;
|
||||
int m_SetCluster = 0;
|
||||
|
||||
std::array<int, 42> m_Bricks;
|
||||
std::array<int, 42> m_Colors;
|
||||
|
||||
@@ -98,6 +103,7 @@ private:
|
||||
bool OnBrickGenerating(const dd::Events::BrickGenerating &event);
|
||||
bool OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event);
|
||||
void GetBrickSet();
|
||||
void CreateBloodEffect(glm::vec3);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "Rendering/CSprite.h"
|
||||
#include "Rendering/CModel.h"
|
||||
#include "Rendering/CPointLight.h"
|
||||
#include "Rendering/CCamera.h"
|
||||
|
||||
#include "Transform/EMove.h"
|
||||
|
||||
@@ -59,6 +60,7 @@
|
||||
#include "Game/EKrakenAppear.h"
|
||||
#include "Game/EKrakenDefeated.h"
|
||||
#include "Game/EBrickGenerating.h"
|
||||
#include "Game/EBreakAllBricks.h"
|
||||
|
||||
#include "Physics/CPhysics.h"
|
||||
#include "Physics/CCircleShape.h"
|
||||
@@ -101,7 +103,7 @@ public:
|
||||
void CreateBasicLevel(int, int, glm::vec2, float);
|
||||
void CreateLevel(int);
|
||||
EntityID CreateBrick(int, int, glm::vec2, float, int, int, int, glm::vec4);
|
||||
void BrickHit(EntityID, EntityID, int);
|
||||
void BrickHit(EntityID, EntityID, int, bool);
|
||||
|
||||
void OnEntityRemoved(EntityID entity);
|
||||
|
||||
@@ -180,6 +182,7 @@ private:
|
||||
bool m_BrickGenerating = false;
|
||||
dd::Events::BrickGenerating m_BrickGeneratingEvent;
|
||||
|
||||
bool m_KrakenBattle = false;
|
||||
bool m_BreakAllBricks = false;
|
||||
|
||||
dd::EventRelay<LevelSystem, dd::Events::Contact> m_EContact;
|
||||
@@ -194,6 +197,7 @@ private:
|
||||
dd::EventRelay<LevelSystem, dd::Events::Resume> m_EResume;
|
||||
dd::EventRelay<LevelSystem, dd::Events::HitPad> m_EHitPad;
|
||||
dd::EventRelay<LevelSystem, dd::Events::BrickGenerating> m_EBrickGenerating;
|
||||
dd::EventRelay<LevelSystem, dd::Events::BreakAllBricks> m_EBreakAllBricks;
|
||||
dd::EventRelay<LevelSystem, dd::Events::KrakenDefeated> m_EKrakenDefeated;
|
||||
|
||||
bool OnContact(const dd::Events::Contact &event);
|
||||
@@ -209,6 +213,7 @@ private:
|
||||
bool OnHitPad(const dd::Events::HitPad &event);
|
||||
bool OnBrickGenerating(const dd::Events::BrickGenerating &event);
|
||||
bool BrickGenerating(const dd::Events::BrickGenerating &event);
|
||||
bool OnBreakAllBricks(const dd::Events::BreakAllBricks &event);
|
||||
void GetBrickSet(int Set, int SetCluster);
|
||||
bool OnKrakenDefeated(const dd::Events::KrakenDefeated &event);
|
||||
|
||||
|
||||
@@ -47,6 +47,10 @@ public:
|
||||
private:
|
||||
bool m_Pause = false;
|
||||
EntityID m_Template;
|
||||
Events::Lifebuoy m_SavedEvent;
|
||||
bool m_Lifebuoy = false;
|
||||
float m_Timer;
|
||||
float m_WaitingTime = 0.4;
|
||||
|
||||
dd::EventRelay<LifebuoySystem, dd::Events::Contact> m_EContact;
|
||||
dd::EventRelay<LifebuoySystem, dd::Events::Pause> m_EPause;
|
||||
@@ -58,6 +62,7 @@ private:
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnResume(const dd::Events::Resume &event);
|
||||
bool OnLifebuoy(const dd::Events::Lifebuoy &event);
|
||||
bool Lifebuoy(const dd::Events::Lifebuoy &event);
|
||||
bool OnLifebuoyHit(const dd::Events::LifebuoyHit &event);
|
||||
|
||||
struct LifebuoyInfo
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include "Rendering/CAnimation.h"
|
||||
|
||||
#include "Game/EBrickGenerating.h"
|
||||
#include "Game/EBreakAllBricks.h"
|
||||
|
||||
|
||||
namespace dd
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "Game/CProjectile.h"
|
||||
#include "Game/CBall.h"
|
||||
#include "Rendering/CSprite.h"
|
||||
#include "Rendering/CAnimation.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
@@ -60,7 +61,7 @@ private:
|
||||
int m_Shots = 0;
|
||||
float m_InkBlasterSpeed = 5;
|
||||
EntityID m_InkBlastTemplate;
|
||||
EntityID m_AttachedSquid;
|
||||
EntityID m_AttachedSquid = 0;
|
||||
|
||||
dd::EventRelay<ProjectileSystem, dd::Events::Contact> m_EContact;
|
||||
dd::EventRelay<ProjectileSystem, dd::Events::Pause> m_EPause;
|
||||
|
||||
@@ -26,6 +26,8 @@ struct ParticleEmitter : public Component
|
||||
//values to interpolate between.
|
||||
std::vector<glm::vec3> ScaleValues;
|
||||
std::vector<float> AlphaValues;
|
||||
std::vector<glm::vec3> VelocityValues;
|
||||
|
||||
|
||||
//System variables
|
||||
float GravityScale = 1.0f;
|
||||
|
||||
@@ -29,6 +29,7 @@ struct CreateParticleSequence : public Event
|
||||
bool DefaultScale = false;
|
||||
std::vector<glm::vec3> ScaleValues;
|
||||
std::vector<float> AlphaValues;
|
||||
std::vector<glm::vec3> VelocityValues;
|
||||
|
||||
//Particle
|
||||
std::string SpriteFile = "";
|
||||
|
||||
@@ -37,8 +37,8 @@ public:
|
||||
void SetFullscreen(bool fullscreen) { m_Fullscreen = fullscreen; }
|
||||
bool VSYNC() const { return m_VSYNC; }
|
||||
void SetVSYNC(bool vsync) { m_VSYNC = vsync; }
|
||||
const dd::Camera* Camera() const { return m_Camera; }
|
||||
void SetCamera(const dd::Camera* camera)
|
||||
dd::Camera* Camera() const { return m_Camera; }
|
||||
void SetCamera(dd::Camera* camera)
|
||||
{
|
||||
if (camera == nullptr) {
|
||||
m_Camera = m_DefaultCamera.get();
|
||||
@@ -55,7 +55,7 @@ protected:
|
||||
bool m_Fullscreen = false;
|
||||
bool m_VSYNC = false;
|
||||
std::unique_ptr<dd::Camera> m_DefaultCamera = nullptr;
|
||||
const dd::Camera* m_Camera = nullptr;
|
||||
dd::Camera* m_Camera = nullptr;
|
||||
GLFWwindow* m_Window = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -30,14 +30,9 @@ namespace Components
|
||||
|
||||
struct Camera : Component
|
||||
{
|
||||
Camera()
|
||||
: FOV(glm::radians(45.f))
|
||||
, NearClip(0.1f)
|
||||
, FarClip(100.f) { }
|
||||
|
||||
float FOV;
|
||||
float NearClip;
|
||||
float FarClip;
|
||||
float FOV = glm::radians(45.f);
|
||||
float NearClip = 0.01f;
|
||||
float FarClip = 100.f;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace dd
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct AnimationComplete
|
||||
struct AnimationComplete : Event
|
||||
{
|
||||
EntityID Entity;
|
||||
std::string Animation;
|
||||
|
||||
@@ -43,7 +43,6 @@ class Renderer : public BaseRenderer
|
||||
public:
|
||||
void Initialize() override;
|
||||
void Draw(RenderQueueCollection& rq) override;
|
||||
void PlaceCamera(glm::vec3 position);
|
||||
|
||||
private:
|
||||
int m_GLVersion[2];
|
||||
@@ -97,12 +96,6 @@ private:
|
||||
void DrawWater(RenderQueue &objects);
|
||||
void DrawGUI(RenderQueue& rq);
|
||||
void DebugKeys();
|
||||
|
||||
dd::EventRelay<Renderer, dd::Events::ScreenShake> m_EScreenShake;
|
||||
bool OnScreenShake(dd::Events::ScreenShake &event);
|
||||
bool m_ScreenShake = false;
|
||||
float m_ShakeIntensity = 0;
|
||||
float m_ShakeTimer = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -91,8 +91,11 @@ int dd::EventBroker::Process(std::string contextTypeName)
|
||||
void dd::EventBroker::Swap()
|
||||
{
|
||||
std::swap(m_EventQueueRead, m_EventQueueWrite);
|
||||
m_EventQueueWrite->clear();
|
||||
}
|
||||
|
||||
void dd::EventBroker::Clear()
|
||||
{
|
||||
m_EventQueueWrite->clear();
|
||||
}
|
||||
|
||||
void dd::EventBroker::subscribeImmediate(dd::BaseEventRelay& relay)
|
||||
|
||||
@@ -28,6 +28,7 @@ void dd::Systems::BallSystem::Initialize()
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &BallSystem::OnActionButton);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &BallSystem::OnStageCleared);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EArrivedAtNewStage, &BallSystem::OnArrivedToNewStage);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EAnimationComplete, &BallSystem::OnAnimationComplete);
|
||||
|
||||
|
||||
//OctoBall
|
||||
@@ -39,7 +40,7 @@ void dd::Systems::BallSystem::Initialize()
|
||||
transform->Velocity = glm::vec3(0.f, 0.f, 0.f);
|
||||
transform->Orientation = glm::quat();
|
||||
auto model = m_World->AddComponent<Components::Model>(ent);
|
||||
model->ModelFile = "Models/Sid/Sid.dae";
|
||||
model->ModelFile = "Models/Sid/Sid_Flying.dae";
|
||||
auto animation = m_World->AddComponent<Components::Animation>(ent);
|
||||
animation->Speed = 1.0;
|
||||
std::shared_ptr<Components::CircleShape> circleShape = m_World->AddComponent<Components::CircleShape>(ent);
|
||||
@@ -118,13 +119,32 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
/*std::uniform_real_distribution<float> dist(-0.5f, 0.5f);
|
||||
float random = dist(m_RandomGenerator);*/
|
||||
transformBall->Velocity = glm::normalize(ballComponent->SavedSpeed) * ballComponent->Speed;
|
||||
|
||||
auto cAnim = m_World->GetComponent<Components::Animation>(entity);
|
||||
cAnim->Loop = false;
|
||||
cAnim->Speed = 2.f;
|
||||
cAnim->Time = 0.f;
|
||||
//transform->Velocity = glm::normalize(glm::vec3(0, 1, 0)) * ballComponent->Speed;
|
||||
} else if (!ballComponent->Sticky) {
|
||||
} else {
|
||||
transformBall->Velocity = glm::vec3(0.f, 0.f, 0.f);
|
||||
//transform->Position = glm::vec3(0.0f, -3.f, -10.f);
|
||||
if (m_First) {
|
||||
transformBall->Orientation = glm::quat();
|
||||
m_First = false;
|
||||
|
||||
auto cModel = m_World->GetComponent<Components::Model>(entity);
|
||||
cModel->ModelFile = "Models/Sid/Sid_Jump.dae";
|
||||
|
||||
auto cAnim = m_World->GetComponent<Components::Animation>(entity);
|
||||
cAnim->Speed = 0.f;
|
||||
cAnim->Time = 0.f;
|
||||
cAnim->Loop = false;
|
||||
|
||||
if (!ballComponent->Sticky) {
|
||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||
transform->Velocity = glm::vec3(0.f, 0.f, 0.f);
|
||||
//transform->Position = glm::vec3(0.0f, -3.f, -10.f);
|
||||
|
||||
if (m_First) {
|
||||
transform->Orientation = glm::quat();
|
||||
m_First = false;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -138,6 +158,12 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
if (m_StickyCounter > 0) {
|
||||
m_Sticky = true;
|
||||
}
|
||||
|
||||
auto cAnim = m_World->GetComponent<Components::Animation>(entity);
|
||||
cAnim->Speed = 2.f;
|
||||
cAnim->Time = 0.f;
|
||||
cAnim->Loop = false;
|
||||
|
||||
ballComponent->Sticky = false;
|
||||
}
|
||||
}
|
||||
@@ -190,7 +216,8 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||
glm::vec2 dir = glm::normalize(glm::vec2(transform->Velocity.x, transform->Velocity.y));
|
||||
glm::vec2 up = glm::vec2(0.f, 1.f);
|
||||
float angle = glm::acos(glm::dot<float>(dir, up)) * glm::sign(dir.x);
|
||||
|
||||
float angle = atan2(dir.x, dir.y);
|
||||
transform->Orientation = glm::rotate(glm::quat(), angle, glm::vec3(0.f, 0.f, -1.f));
|
||||
}
|
||||
}
|
||||
@@ -330,7 +357,7 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event)
|
||||
m_Waiting = true;
|
||||
m_InkBlockedWaiting = true;
|
||||
ballComponent->Sticky = true;
|
||||
ballComponent->StickyPlacement = glm::vec3(0, 0.5f, 0);
|
||||
ballComponent->StickyPlacement = glm::vec3(0, 0.25f, 0);
|
||||
ballComponent->SavedSpeed = glm::normalize(glm::vec3(x, y, 0.f)) * ballComponent->Speed;
|
||||
ballTransform->Velocity = glm::vec3(0.f, 0.f, 0.f);
|
||||
}
|
||||
@@ -340,11 +367,19 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event)
|
||||
m_Waiting = true;
|
||||
ballComponent->Sticky = true;
|
||||
//ballComponent->StickyPlacement = ballTransform->Position - padTransform->Position;
|
||||
ballComponent->StickyPlacement = glm::vec3(0, 0.5f, 0);
|
||||
ballComponent->StickyPlacement = glm::vec3(0, 0.25f, 0);
|
||||
ballComponent->SavedSpeed = glm::normalize(glm::vec3(x, y, 0.f)) * ballComponent->Speed;
|
||||
ballTransform->Velocity *= -1;
|
||||
Events::StickyAttachedToPad e;
|
||||
EventBroker->Publish(e);
|
||||
|
||||
|
||||
auto cModel = m_World->GetComponent<Components::Model>(ballEntity);
|
||||
cModel->ModelFile = "Models/Sid/Sid_Jump.dae";
|
||||
auto cAnim = m_World->GetComponent<Components::Animation>(ballEntity);
|
||||
cAnim->Loop = false;
|
||||
cAnim->Speed = 0.f;
|
||||
cAnim->Time = 0.f;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -395,10 +430,7 @@ void dd::Systems::BallSystem::ResolveContacts()
|
||||
auto ballComponent = m_World->GetComponent<Components::Ball>(entity);
|
||||
reflectedVelocity = glm::normalize(reflectedVelocity) * ballComponent->Speed;
|
||||
transform->Velocity = glm::vec3(reflectedVelocity, 0.f);
|
||||
|
||||
}
|
||||
|
||||
|
||||
m_Contacts.clear();
|
||||
}
|
||||
|
||||
@@ -474,6 +506,14 @@ bool dd::Systems::BallSystem::OnInkBlasterOver(const dd::Events::InkBlasterOver
|
||||
auto ballComponent = m_World->GetComponent<Components::Ball>(event.Ball);
|
||||
auto transform = m_World->GetComponent<Components::Transform>(event.Ball);
|
||||
|
||||
|
||||
auto cModel = m_World->GetComponent<Components::Model>(event.Ball);
|
||||
cModel->ModelFile = "Models/Sid/Sid_Jump.dae";
|
||||
|
||||
auto cAnim = m_World->GetComponent<Components::Animation>(event.Ball);
|
||||
cAnim->Speed = 2.f;
|
||||
cAnim->Loop = false;
|
||||
|
||||
m_InkBlaster = false;
|
||||
m_InkAttached = false;
|
||||
m_InkBlockedWaiting = false;
|
||||
@@ -520,3 +560,20 @@ bool dd::Systems::BallSystem::OnArrivedToNewStage(const dd::Events::ArrivedAtNew
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::BallSystem::OnAnimationComplete(const dd::Events::AnimationComplete &event)
|
||||
{
|
||||
auto model = m_World->GetComponent<Components::Model>(event.Entity);
|
||||
if (model) {
|
||||
if (model->ModelFile == "Models/Sid/Sid_Jump.dae") {
|
||||
model->ModelFile = "Models/Sid/Sid_Flying.dae";
|
||||
|
||||
auto anim = m_World->GetComponent<Components::Animation>(event.Entity);
|
||||
anim->Speed = 1.f;
|
||||
anim->Loop = true;
|
||||
anim->Time = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+139
-61
@@ -93,12 +93,14 @@ void dd::Systems::KrakenSystem::UpdateEntity(double dt, EntityID entity, EntityI
|
||||
return;
|
||||
}
|
||||
Events::KrakenAttack krakenAttack;
|
||||
switch (kraken->CurrentAction)
|
||||
{
|
||||
switch (kraken->CurrentAction) {
|
||||
case 1: // Idle
|
||||
m_KrakenTimer += dt;
|
||||
if (m_RandomKraken) {
|
||||
m_KrakenTimer += dt;
|
||||
}
|
||||
if (m_KrakenTimer > m_KrakenCurrentSecondsToAction) {
|
||||
m_KrakenTimer = 0;
|
||||
kraken->CurrentAction = 3;
|
||||
if (m_NumberOfActions == 0) {
|
||||
kraken->CurrentAction = 3;
|
||||
} else {
|
||||
@@ -112,11 +114,12 @@ void dd::Systems::KrakenSystem::UpdateEntity(double dt, EntityID entity, EntityI
|
||||
break;
|
||||
case 2: // Grabbing
|
||||
m_NumberOfActions++;
|
||||
kraken->CurrentAction = 5;
|
||||
krakenAttack.ChargeUpdate = 0;
|
||||
kraken->CurrentAction = 3;
|
||||
/*krakenAttack.ChargeUpdate = 0;
|
||||
krakenAttack.KrakenStrength = 0.1;
|
||||
krakenAttack.PlayerStrength = 0.05;
|
||||
EventBroker->Publish(krakenAttack);
|
||||
EventBroker->Publish(krakenAttack);*/
|
||||
|
||||
break;
|
||||
case 3: // Brick Generating
|
||||
{
|
||||
@@ -125,35 +128,60 @@ void dd::Systems::KrakenSystem::UpdateEntity(double dt, EntityID entity, EntityI
|
||||
Events::BrickGenerating e;
|
||||
e.Origin1 = glm::vec3(-5, 7, -10);
|
||||
e.Origin2 = glm::vec3(5, 7, -10);
|
||||
if (kraken->Health > 20) {
|
||||
e.Speed = 10;
|
||||
if (m_RandomKraken) {
|
||||
if (kraken->Health > 20) {
|
||||
e.SetCluster = 0;
|
||||
} else if (kraken->Health > 10) {
|
||||
} else if (kraken->Health > 10) {
|
||||
e.SetCluster = 1;
|
||||
} else {
|
||||
} else {
|
||||
e.SetCluster = 2;
|
||||
}
|
||||
std::uniform_real_distribution<float> dist(1, 6.999f);
|
||||
float random = dist(m_RandomGenerator);
|
||||
e.Set = random;
|
||||
} else {
|
||||
e.Set = m_Set;
|
||||
e.SetCluster = m_SetCluster;
|
||||
m_Set++;
|
||||
if (m_Set > 6) {
|
||||
m_SetCluster++;
|
||||
m_Set = 1;
|
||||
}
|
||||
}
|
||||
std::uniform_real_distribution<float> dist(1, 6.999f);
|
||||
float random = dist(m_RandomGenerator);
|
||||
e.Set = random;
|
||||
|
||||
EventBroker->Publish(e);
|
||||
break;
|
||||
}
|
||||
case 4: // Brick Generating second case
|
||||
{
|
||||
m_NumberOfActions++;
|
||||
kraken->CurrentAction = 1;
|
||||
Events::BrickGenerating e;
|
||||
e.Origin1 = glm::vec3(-5, 7, -10);
|
||||
e.Origin2 = glm::vec3(5, 7, -10);
|
||||
if (kraken->Health > 20) {
|
||||
e.SetCluster = 0;
|
||||
} else if (kraken->Health > 10) {
|
||||
e.SetCluster = 1;
|
||||
e.Speed = 10;
|
||||
if (m_RandomKraken) {
|
||||
if (kraken->Health > 20) {
|
||||
e.SetCluster = 0;
|
||||
} else if (kraken->Health > 10) {
|
||||
e.SetCluster = 1;
|
||||
} else {
|
||||
e.SetCluster = 2;
|
||||
}
|
||||
std::uniform_real_distribution<float> dist(1, 6.999f);
|
||||
float random = dist(m_RandomGenerator);
|
||||
e.Set = random;
|
||||
} else {
|
||||
e.SetCluster = 2;
|
||||
e.Set = m_Set;
|
||||
e.SetCluster = m_SetCluster;
|
||||
m_Set++;
|
||||
if (m_Set > 6) {
|
||||
m_SetCluster++;
|
||||
m_Set = 1;
|
||||
}
|
||||
}
|
||||
std::uniform_real_distribution<float> dist(1, 6.999f);
|
||||
float random = dist(m_RandomGenerator);
|
||||
e.Set = random;
|
||||
|
||||
EventBroker->Publish(e);
|
||||
break;
|
||||
}
|
||||
@@ -261,6 +289,13 @@ bool dd::Systems::KrakenSystem::OnKrakenAppear(const dd::Events::KrakenAppear &e
|
||||
transform->Position = event.Position;
|
||||
transform->Position.y += 3.f;
|
||||
m_KrakenBattle = true;
|
||||
|
||||
Events::ScreenShake e;
|
||||
e.Intensity = 10;
|
||||
e.Time = 2;
|
||||
e.TimeTakenToCoolDown = 6;
|
||||
EventBroker->Publish(e);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -269,6 +304,13 @@ bool dd::Systems::KrakenSystem::OnKrakenAttack(const dd::Events::KrakenAttack &e
|
||||
if (event.ChargeUpdate >= 1) {
|
||||
m_ReturnToIdle = true;
|
||||
}
|
||||
|
||||
Events::ScreenShake e;
|
||||
e.Intensity = 2;
|
||||
e.Time = 0.5f;
|
||||
e.TimeTakenToCoolDown = 3.f;
|
||||
EventBroker->Publish(e);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -277,6 +319,7 @@ bool dd::Systems::KrakenSystem::OnKrakenHit(const dd::Events::KrakenHit &event)
|
||||
auto kraken = m_World->GetComponent<Components::Kraken>(event.Kraken);
|
||||
auto transform = m_World->GetComponent<Components::Transform>(event.Hitter);
|
||||
kraken->Health--;
|
||||
kraken->CurrentAction = 3;
|
||||
//kraken->Health -= 15;
|
||||
//kraken->Health = -1; //To defeat the kraken instantly.
|
||||
|
||||
@@ -289,47 +332,7 @@ bool dd::Systems::KrakenSystem::OnKrakenHit(const dd::Events::KrakenHit &event)
|
||||
m_KrakenCurrentSecondsToAction = m_KrakenMaxSecondsToAction - (modifier * timeDifferenceBetweenMaxAndMin);
|
||||
// If modifier is 1, MaxSeconds is 15, MinSeconds is 5, then... 15 - (1 * 10), meaning 5.
|
||||
|
||||
auto ball = m_World->GetComponent<Components::Transform>(event.Hitter);
|
||||
if (ball != nullptr) {
|
||||
//Particle trail
|
||||
Events::CreateParticleSequence trail;
|
||||
trail.parent = event.Hitter;
|
||||
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 = 2;
|
||||
trail.EmitterLifeTime = 1.f;
|
||||
trail.ParticleLifeTime = 1.f;
|
||||
trail.ParticlesPerTick = 1;
|
||||
trail.SpawnRate = 0.5f;
|
||||
trail.Speed = 10.f;
|
||||
trail.EmittingAngle = glm::half_pi<float>();
|
||||
trail.SpriteFile = "Textures/Particles/FadeBall.png";
|
||||
trail.Color = glm::vec4(1, 0, 0, 1);
|
||||
//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 = 2;
|
||||
poof.Position = transform->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 = glm::vec4(1, 0, 0, 1);
|
||||
poof.AlphaValues.clear();
|
||||
poof.AlphaValues.push_back(1.f);
|
||||
poof.AlphaValues.push_back(0.f);
|
||||
poof.Speed = 20;
|
||||
EventBroker->Publish(poof);
|
||||
CreateBloodEffect(transform->Position);
|
||||
|
||||
//std::cout << kraken->Health << std::endl;
|
||||
//kraken->Health = -1;
|
||||
@@ -339,12 +342,21 @@ bool dd::Systems::KrakenSystem::OnKrakenHit(const dd::Events::KrakenHit &event)
|
||||
e.Hitter = event.Hitter;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
|
||||
Events::ScreenShake e;
|
||||
e.Intensity = 2;
|
||||
e.Time = 0.2f;
|
||||
e.TimeTakenToCoolDown = 1.5f;
|
||||
EventBroker->Publish(e);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool dd::Systems::KrakenSystem::OnKrakenDefeated(const dd::Events::KrakenDefeated &event)
|
||||
{
|
||||
m_KrakenBattle = false;
|
||||
m_Set = 0;
|
||||
m_SetCluster = 0;
|
||||
|
||||
auto kraken = m_World->GetComponent<Components::Kraken>(event.Kraken);
|
||||
auto physicsComponent = m_World->GetComponent<Components::Physics>(event.Kraken);
|
||||
@@ -438,3 +450,69 @@ bool dd::Systems::KrakenSystem::OnArrivedAtNewStage(const dd::Events::ArrivedAtN
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dd::Systems::KrakenSystem::CreateBloodEffect(glm::vec3 pos)
|
||||
{
|
||||
//ParticlePoof
|
||||
Events::CreateParticleSequence dust;
|
||||
dust.EmitterLifeTime = 4;
|
||||
dust.EmittingAngle = glm::half_pi<float>();
|
||||
dust.Spread = 0.5f;
|
||||
dust.NumberOfTicks = 1;
|
||||
dust.ParticleLifeTime = 1.f;
|
||||
dust.ParticlesPerTick = 1;
|
||||
dust.Position = pos;
|
||||
dust.ScaleValues.clear();
|
||||
dust.ScaleValues.push_back(glm::vec3(0.5f));
|
||||
dust.ScaleValues.push_back(glm::vec3(2.f, 2.f, 0.2f));
|
||||
dust.SpriteFile = "Textures/Particles/Cloud_Particle.png";
|
||||
dust.Color = glm::vec4(1, 0, 0, 1);
|
||||
dust.AlphaValues.clear();
|
||||
dust.AlphaValues.push_back(1.f);
|
||||
dust.AlphaValues.push_back(0.f);
|
||||
dust.Speed = 20;
|
||||
EventBroker->Publish(dust);
|
||||
std::uniform_real_distribution<float> dist(glm::pi<float>(), glm::two_pi<float>());
|
||||
for (int i = 0; i < 3; i++) {
|
||||
float angle = dist(m_RandomGenerator);
|
||||
|
||||
Events::CreateParticleSequence squirt;
|
||||
squirt.EmitterLifeTime = 0.3f;
|
||||
squirt.EmittingAngle = angle;
|
||||
squirt.Spread = 0;
|
||||
squirt.SpawnRate = 0.01f;
|
||||
squirt.ParticleLifeTime = 0.5f;
|
||||
squirt.ParticlesPerTick = 1;
|
||||
squirt.Position = pos;
|
||||
squirt.ScaleValues.clear();
|
||||
squirt.ScaleValues.push_back(glm::vec3(0.09f));
|
||||
squirt.SpriteFile = "Textures/Particles/FadeBall.png";
|
||||
squirt.Color = glm::vec4(1, 0, 0, 1);
|
||||
squirt.AlphaValues.clear();
|
||||
squirt.AlphaValues.push_back(1.f);
|
||||
squirt.AlphaValues.push_back(0.f);
|
||||
squirt.Speed = 1000;
|
||||
EventBroker->Publish(squirt);
|
||||
}
|
||||
Events::CreateParticleSequence drop;
|
||||
drop.EmitterLifeTime = 7.f;
|
||||
drop.SpawnRate = 0.1f;
|
||||
//drop.EmittingAngle = glm::two_pi<float>() + glm::pi<float>();
|
||||
drop.EmittingAngle = -glm::half_pi<float>();
|
||||
drop.Spread = 0;
|
||||
//drop.Spread = glm::two_pi<float>();
|
||||
drop.ParticleLifeTime = 1.f;
|
||||
drop.ParticlesPerTick = 2;
|
||||
drop.Position = pos;
|
||||
drop.ScaleValues.clear();
|
||||
drop.ScaleValues.push_back(glm::vec3(.15f));
|
||||
drop.ScaleValues.push_back(glm::vec3(0.1f));
|
||||
drop.SpriteFile = "Textures/Particles/FadeBall.png";
|
||||
drop.Color = glm::vec4(1, 0, 0, 1);
|
||||
drop.AlphaValues.clear();
|
||||
drop.AlphaValues.push_back(1.f);
|
||||
drop.AlphaValues.push_back(0.f);
|
||||
drop.GravityScale = 0;
|
||||
drop.Speed = 300;
|
||||
EventBroker->Publish(drop);
|
||||
}
|
||||
+108
-69
@@ -23,10 +23,20 @@ void dd::Systems::LevelSystem::Initialize()
|
||||
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_EBreakAllBricks, &LevelSystem::OnBreakAllBricks);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EKrakenDefeated, &LevelSystem::OnKrakenDefeated);
|
||||
|
||||
m_GodMode = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<bool>("Cheat.GodMode", false);
|
||||
|
||||
// Camera
|
||||
{
|
||||
auto ent = m_World->CreateEntity();
|
||||
auto transform = m_World->AddComponent<Components::Transform>(ent);
|
||||
auto camera = m_World->AddComponent<Components::Camera>(ent);
|
||||
camera->FOV = glm::radians(58.31f);
|
||||
m_World->CommitEntity(ent);
|
||||
}
|
||||
|
||||
//PointLightTest
|
||||
{
|
||||
auto t_Light = m_World->CreateEntity();
|
||||
@@ -68,8 +78,20 @@ void dd::Systems::LevelSystem::Initialize()
|
||||
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
|
||||
|
||||
// Added to prevent white borders around screen shake
|
||||
{
|
||||
auto halfPipeBackground = m_World->CreateEntity();
|
||||
auto transform = m_World->AddComponent<Components::Transform>(halfPipeBackground);
|
||||
transform->Position = glm::vec3(0.f, 0.f, -15.f);
|
||||
transform->Scale = glm::vec3(6.f, 6.f, 10.f) * 2.f;
|
||||
auto model = m_World->AddComponent<Components::Model>(halfPipeBackground);
|
||||
model->ModelFile = "Models/Halfpipe.obj";
|
||||
m_World->CommitEntity(halfPipeBackground);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Background
|
||||
|
||||
/*{
|
||||
@@ -132,8 +154,8 @@ void dd::Systems::LevelSystem::Initialize()
|
||||
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::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);
|
||||
@@ -279,12 +301,18 @@ void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
}
|
||||
}
|
||||
|
||||
if (m_BreakAllBricks) {
|
||||
if (m_LooseBricks == 1 && m_KrakenBattle) {
|
||||
m_BreakAllBricks = false;
|
||||
}
|
||||
}
|
||||
|
||||
auto brick = m_World->GetComponent<Components::Brick>(entity);
|
||||
if (brick != nullptr) {
|
||||
if (m_BreakAllBricks) {
|
||||
if (!brick->Removed) {
|
||||
brick->Removed = true;
|
||||
BrickHit(entity, entity, 1);
|
||||
BrickHit(entity, entity, 0, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +364,7 @@ void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
auto ball = m_World->GetComponent<Components::Ball>(entity);
|
||||
|
||||
if (ball != nullptr) {
|
||||
if (m_BrickGenerating) {
|
||||
if (m_BrickGenerating && !m_BreakAllBricks) {
|
||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||
if (transform->Position.y < 0 && transform->Velocity.y < 0) {
|
||||
m_BrickGenerating = false;
|
||||
@@ -477,6 +505,7 @@ EntityID dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spac
|
||||
model->ModelFile = "Models/Brick/KrakenBrick.obj";
|
||||
|
||||
} else if (typeInt == Kraken) {
|
||||
m_KrakenBattle = true;
|
||||
Events::KrakenAppear e;
|
||||
e.Position = transform->Position;
|
||||
e.Health = 10;
|
||||
@@ -491,6 +520,7 @@ EntityID dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spac
|
||||
|
||||
bool dd::Systems::LevelSystem::OnBrickGenerating(const dd::Events::BrickGenerating &event)
|
||||
{
|
||||
m_BreakAllBricks = true;
|
||||
m_BrickGenerating = true;
|
||||
m_BrickGeneratingEvent = event;
|
||||
return true;
|
||||
@@ -523,7 +553,7 @@ bool dd::Systems::LevelSystem::BrickGenerating(const dd::Events::BrickGenerating
|
||||
}
|
||||
brick->GenerationGoal = e.GoalPosition;
|
||||
e.Entity = ent;
|
||||
e.Speed = 6;
|
||||
e.Speed = event.Speed;
|
||||
e.Queue = false;
|
||||
EventBroker->Publish(e);
|
||||
m_LooseBricks++;
|
||||
@@ -536,6 +566,12 @@ bool dd::Systems::LevelSystem::BrickGenerating(const dd::Events::BrickGenerating
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::LevelSystem::OnBreakAllBricks(const dd::Events::BreakAllBricks &event)
|
||||
{
|
||||
m_BreakAllBricks = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are sets the Kraken gets!
|
||||
{
|
||||
std::array<int, 42> level;
|
||||
@@ -587,10 +623,10 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
} else if (set == 2) {
|
||||
level = // The Audience
|
||||
{0, 0, 0, 0, 0, 0, 0,
|
||||
4, 0, 0, 0, 0, 0, 1,
|
||||
1, 0, 0, 0, 0, 0, 1,
|
||||
1, 0, 0, 0, 0, 0, 1,
|
||||
1, 0, 0, 0, 0, 0, 1,
|
||||
1, 0, 0, 0, 0, 0, 1,
|
||||
1, 0, 0, 0, 0, 0, 6,
|
||||
0, 0, 0, 0, 0, 0, 0 };
|
||||
color =
|
||||
{y, y, y, y, y, y, y,
|
||||
@@ -604,8 +640,8 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
{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, 1, 0,
|
||||
1, 1, 1, 0, 1, 1, 1,
|
||||
0, 3, 0, 0, 0, 1, 0,
|
||||
1, 1, 6, 0, 1, 1, 1,
|
||||
0, 0, 0, 0, 0, 0, 0 };
|
||||
color =
|
||||
{b, b, b, b, b, b, b,
|
||||
@@ -617,11 +653,11 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
} else if (set == 4) {
|
||||
level = // The Scales (right)
|
||||
{1, 1, 1, 0, 0, 0, 0,
|
||||
1, 1, 1, 0, 0, 0, 0,
|
||||
1, 1, 6, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 1, 1, 1,
|
||||
0, 0, 0, 0, 1, 1, 1 };
|
||||
0, 0, 0, 0, 1, 4, 1 };
|
||||
color =
|
||||
{m, m, m, m, m, m, m,
|
||||
m, m, m, m, m, m, m,
|
||||
@@ -632,11 +668,11 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
} else if (set == 5) {
|
||||
level = // The Scales (left)
|
||||
{0, 0, 0, 0, 1, 1, 1,
|
||||
0, 0, 0, 0, 1, 1, 1,
|
||||
0, 0, 0, 0, 1, 3, 1,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 0, 0, 0, 0,
|
||||
1, 1, 1, 0, 0, 0, 0 };
|
||||
1, 6, 1, 0, 0, 0, 0 };
|
||||
color =
|
||||
{g, g, g, g, g, g, g,
|
||||
g, g, g, g, g, g, g,
|
||||
@@ -647,7 +683,7 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
} else if (set == 6) {
|
||||
level = // The Sword
|
||||
{0, 0, 0, 1, 0, 0, 0,
|
||||
0, 0, 1, 1, 1, 0, 0,
|
||||
0, 0, 6, 2, 6, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 0,
|
||||
@@ -665,8 +701,8 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
level = // The Wall
|
||||
{1, 0, 0, 0, 0, 0, 1,
|
||||
1, 0, 0, 0, 0, 0, 1,
|
||||
1, 0, 0, 0, 0, 0, 1,
|
||||
1, 1, 1, 1, 1, 1, 2,
|
||||
6, 0, 0, 0, 0, 0, 6,
|
||||
1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1,
|
||||
0, 0, 0, 0, 0, 0, 0 };
|
||||
color =
|
||||
@@ -680,7 +716,7 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
level = // The Checkerboard
|
||||
{0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
3, 0, 1, 0, 1, 0, 1,
|
||||
3, 0, 1, 0, 6, 0, 1,
|
||||
0, 1, 0, 1, 0, 1, 0,
|
||||
1, 0, 1, 0, 1, 0, 1,
|
||||
0, 0, 0, 0, 0, 0, 0 };
|
||||
@@ -695,7 +731,7 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
level = // The Fighter Jet
|
||||
{0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
1, 0, 1, 0, 1, 0, 1,
|
||||
6, 0, 1, 0, 1, 0, 6,
|
||||
0, 1, 1, 1, 1, 1, 0,
|
||||
0, 0, 4, 1, 1, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 0 };
|
||||
@@ -709,9 +745,9 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
} else if (set == 4) {
|
||||
level = // The Formation
|
||||
{0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 1, 1, 3, 1,
|
||||
1, 1, 4, 1, 1, 3, 1,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 6, 1, 1, 1, 1,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0 };
|
||||
color =
|
||||
@@ -725,9 +761,9 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
level = // The Pillars
|
||||
{0, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 1, 0, 1, 1, 0,
|
||||
0, 1, 2, 0, 1, 1, 0,
|
||||
0, 1, 1, 0, 1, 1, 0,
|
||||
0, 6, 1, 0, 1, 6, 0,
|
||||
0, 1, 1, 0, 1, 1, 0,
|
||||
0, 1, 3, 0, 3, 1, 0,
|
||||
0, 0, 0, 0, 0, 0, 0 };
|
||||
color =
|
||||
{g, g, g, g, g, g, g,
|
||||
@@ -740,8 +776,8 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
level = // The Treasure Chest
|
||||
{0, 0, 0, 1, 0, 0, 0,
|
||||
0, 0, 1, 1, 1, 0, 0,
|
||||
0, 1, 1, 5, 1, 1, 0,
|
||||
0, 0, 1, 1, 1, 0, 0,
|
||||
0, 1, 1, 2, 1, 1, 0,
|
||||
0, 0, 1, 6, 1, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0 };
|
||||
color =
|
||||
@@ -755,11 +791,11 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
} else if (setCluster == 2) {
|
||||
if (set == 1) {
|
||||
level = // The Butterfly
|
||||
{1, 0, 0, 1, 0, 0, 1,
|
||||
{4, 0, 0, 1, 0, 0, 1,
|
||||
1, 6, 0, 1, 0, 1, 1,
|
||||
1, 1, 1, 6, 1, 1, 1,
|
||||
1, 1, 0, 1, 0, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 0, 1, 0, 1, 1,
|
||||
1, 0, 0, 2, 0, 0, 1,
|
||||
1, 0, 0, 1, 0, 0, 1,
|
||||
1, 0, 0, 1, 0, 0, 3 };
|
||||
color =
|
||||
{r, r, r, r, r, r, r,
|
||||
@@ -771,7 +807,7 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
} else if (set == 2) {
|
||||
level = // The Cross
|
||||
{1, 1, 0, 0, 0, 1, 1,
|
||||
0, 4, 1, 0, 1, 1, 0,
|
||||
0, 4, 1, 0, 1, 6, 0,
|
||||
0, 0, 1, 1, 1, 0, 0,
|
||||
0, 0, 1, 3, 1, 0, 0,
|
||||
0, 1, 1, 0, 1, 1, 0,
|
||||
@@ -785,11 +821,11 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
y, y, y, y, y, y, y };
|
||||
} else if (set == 3) {
|
||||
level = // The Inverted Cross
|
||||
{0, 0, 1, 6, 1, 0, 0,
|
||||
1, 0, 0, 1, 0, 0, 1,
|
||||
1, 1, 0, 0, 0, 1, 3,
|
||||
{0, 0, 1, 1, 1, 0, 0,
|
||||
1, 0, 0, 6, 0, 0, 1,
|
||||
4, 1, 0, 0, 0, 1, 3,
|
||||
1, 1, 0, 0, 0, 1, 1,
|
||||
1, 0, 0, 1, 0, 0, 1,
|
||||
1, 0, 0, 6, 0, 0, 1,
|
||||
0, 0, 1, 1, 1, 0, 0 };
|
||||
color =
|
||||
{b, b, b, b, b, b, b,
|
||||
@@ -801,9 +837,9 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
} else if (set == 4) {
|
||||
level = // The Great Wall
|
||||
{1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 6, 1, 1, 1, 1,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 1, 1, 5, 1,
|
||||
1, 6, 1, 1, 1, 1, 1,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
1, 3, 1, 1, 1, 1, 1 };
|
||||
color =
|
||||
@@ -816,10 +852,10 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
} else if (set == 5) {
|
||||
level = // The Champion
|
||||
{0, 0, 1, 1, 1, 0, 0,
|
||||
0, 0, 1, 1, 2, 0, 0,
|
||||
0, 0, 1, 1, 1, 0, 0,
|
||||
0, 0, 1, 1, 1, 0, 0,
|
||||
1, 1, 1, 0, 1, 1, 1,
|
||||
5, 1, 1, 0, 1, 1, 1,
|
||||
3, 6, 1, 0, 1, 6, 1,
|
||||
1, 1, 1, 0, 1, 1, 1 };
|
||||
color =
|
||||
{g, g, g, g, g, g, g,
|
||||
@@ -830,10 +866,10 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
||||
g, g, g, g, g, g, g };
|
||||
} else if (set == 6) {
|
||||
level = // The Dog. What, you can't see it? XD
|
||||
{0, 1, 1, 1, 1, 1, 0,
|
||||
1, 1, 2, 1, 2, 1, 1,
|
||||
{0, 1, 1, 6, 1, 1, 0,
|
||||
1, 1, 4, 5, 4, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1,
|
||||
1, 0, 1, 1, 1, 0, 1,
|
||||
6, 0, 1, 1, 1, 0, 6,
|
||||
1, 0, 1, 1, 1, 0, 1,
|
||||
0, 0, 0, 3, 0, 0, 0 };
|
||||
color =
|
||||
@@ -912,7 +948,7 @@ bool dd::Systems::LevelSystem::OnContact(const dd::Events::Contact &event)
|
||||
// For when a brick gets shot.
|
||||
brick->Removed = true;
|
||||
m_World->RemoveEntity(entityShot);
|
||||
BrickHit(entityShot, entityBrick, 1);
|
||||
BrickHit(entityShot, entityBrick, 1, true);
|
||||
//ep.Radius = 0.05;
|
||||
|
||||
return true;
|
||||
@@ -928,13 +964,13 @@ bool dd::Systems::LevelSystem::OnContact(const dd::Events::Contact &event)
|
||||
ec.Ball = entityBall;
|
||||
EventBroker->Publish(ec);
|
||||
|
||||
BrickHit(entityBall, entityBrick, ball->Combo);
|
||||
BrickHit(entityBall, entityBrick, ball->Combo, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void dd::Systems::LevelSystem::BrickHit(EntityID entityHitter, EntityID entityBrick, int combo)
|
||||
void dd::Systems::LevelSystem::BrickHit(EntityID entityHitter, EntityID entityBrick, int combo, bool activatePowerUps)
|
||||
{
|
||||
auto brick = m_World->GetComponent<Components::Brick>(entityBrick);
|
||||
auto physicsComponent = m_World->GetComponent<Components::Physics>(entityBrick);
|
||||
@@ -951,47 +987,49 @@ void dd::Systems::LevelSystem::BrickHit(EntityID entityHitter, EntityID entityBr
|
||||
}
|
||||
|
||||
// Check if the brick is any kind of special.
|
||||
auto multi = m_World->GetComponent<Components::MultiBallBrick>(entityBrick);
|
||||
if (multi != nullptr) {
|
||||
Events::MultiBall e;
|
||||
e.padTransform = transformComponentBrick;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
else {
|
||||
auto buoy = m_World->GetComponent<Components::LifebuoyBrick>(entityBrick);
|
||||
if (buoy != nullptr) {
|
||||
Events::Lifebuoy e;
|
||||
e.Transform = transformComponentBrick;
|
||||
if (activatePowerUps) {
|
||||
auto multi = m_World->GetComponent<Components::MultiBallBrick>(entityBrick);
|
||||
if (multi != nullptr) {
|
||||
Events::MultiBall e;
|
||||
e.padTransform = transformComponentBrick;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
else {
|
||||
auto sticky = m_World->GetComponent<Components::StickyBrick>(entityBrick);
|
||||
if (sticky != nullptr) {
|
||||
Events::StickyPad e;
|
||||
auto buoy = m_World->GetComponent<Components::LifebuoyBrick>(entityBrick);
|
||||
if (buoy != nullptr) {
|
||||
Events::Lifebuoy e;
|
||||
e.Transform = transformComponentBrick;
|
||||
e.Times = 3;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
else {
|
||||
auto ink = m_World->GetComponent<Components::InkBlasterBrick>(entityBrick);
|
||||
if (ink != nullptr) {
|
||||
Events::InkBlaster e;
|
||||
auto sticky = m_World->GetComponent<Components::StickyBrick>(entityBrick);
|
||||
if (sticky != nullptr) {
|
||||
Events::StickyPad e;
|
||||
e.Transform = transformComponentBrick;
|
||||
e.Shots = 5;
|
||||
e.Speed = 7;
|
||||
e.Times = 3;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
else {
|
||||
auto kraken = m_World->GetComponent<Components::KrakenAttackBrick>(entityBrick);
|
||||
if (kraken != nullptr) {
|
||||
Events::KrakenAttack e;
|
||||
e.ChargeUpdate = 0;
|
||||
e.KrakenStrength = 0.1;
|
||||
e.PlayerStrength = 0.05;
|
||||
auto ink = m_World->GetComponent<Components::InkBlasterBrick>(entityBrick);
|
||||
if (ink != nullptr) {
|
||||
Events::InkBlaster e;
|
||||
e.Transform = transformComponentBrick;
|
||||
e.Shots = 5;
|
||||
e.Speed = 7;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
else {
|
||||
auto kraken = m_World->GetComponent<Components::KrakenAttackBrick>(entityBrick);
|
||||
if (kraken != nullptr) {
|
||||
Events::KrakenAttack e;
|
||||
e.ChargeUpdate = 0;
|
||||
e.KrakenStrength = 0.1;
|
||||
e.PlayerStrength = 0.05;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1128,6 +1166,7 @@ bool dd::Systems::LevelSystem::OnPowerUpTaken(const dd::Events::PowerUpTaken &ev
|
||||
|
||||
bool dd::Systems::LevelSystem::OnKrakenDefeated(const dd::Events::KrakenDefeated &event)
|
||||
{
|
||||
m_KrakenBattle = false;
|
||||
m_BrickGenerating = false;
|
||||
m_BreakAllBricks = true;
|
||||
SetNumberOfBricks(NumberOfBricks() - 1);
|
||||
|
||||
@@ -76,6 +76,19 @@ void dd::Systems::LifebuoySystem::Update(double dt)
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsPaused()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_Lifebuoy) {
|
||||
m_Timer += dt;
|
||||
if (m_Timer > m_WaitingTime) {
|
||||
m_Timer = 0;
|
||||
m_Lifebuoy = false;
|
||||
Lifebuoy(m_SavedEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dd::Systems::LifebuoySystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||
@@ -114,6 +127,13 @@ bool dd::Systems::LifebuoySystem::OnContact(const dd::Events::Contact &event)
|
||||
}
|
||||
|
||||
bool dd::Systems::LifebuoySystem::OnLifebuoy(const dd::Events::Lifebuoy &event)
|
||||
{
|
||||
m_Lifebuoy = true;
|
||||
m_SavedEvent = event;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::LifebuoySystem::Lifebuoy(const dd::Events::Lifebuoy &event)
|
||||
{
|
||||
auto ent = m_World->CloneEntity(m_Template);
|
||||
m_World->SetProperty(ent, "Name", "Lifebuoy");
|
||||
@@ -121,7 +141,8 @@ bool dd::Systems::LifebuoySystem::OnLifebuoy(const dd::Events::Lifebuoy &event)
|
||||
auto transform = m_World->GetComponent<Components::Transform>(ent);
|
||||
auto physics = m_World->GetComponent<Components::Physics>(ent);
|
||||
physics->CollisionType = CollisionType::Type::Dynamic;
|
||||
transform->Position = glm::vec3(0.f, 0.f, -10.f);
|
||||
//transform->Position = glm::vec3(0.f, 0.f, -10.f);
|
||||
transform->Position = event.Transform->Position;
|
||||
transform->Velocity = glm::vec3(20.f, 3.f, 0.f);
|
||||
LifebuoyInfo info;
|
||||
info.Entity = ent;
|
||||
|
||||
@@ -56,6 +56,7 @@ void dd::Systems::PadSystem::Initialize()
|
||||
cModel->ModelFile = "Models/Ship/Ship.obj";
|
||||
|
||||
auto pad = m_World->AddComponent<Components::Pad>(ent);
|
||||
pad->SlowdownModifier = 10.f;
|
||||
m_World->CommitEntity(ent);
|
||||
|
||||
m_Edge = 3.2 - (ctransform->Scale.x / 2);
|
||||
@@ -123,20 +124,25 @@ void dd::Systems::PadSystem::UpdateEntity(double dt, EntityID entity, EntityID p
|
||||
if (ball->Waiting || ball->Sticky) {
|
||||
if (m_ResetBall && ball->Waiting) {
|
||||
ball->StickyPlacement = glm::vec3(0.f, 0.f, 0.f);
|
||||
ball->StickyPlacement.y += 0.45f;
|
||||
ball->StickyPlacement.y += 0.25f;
|
||||
m_ResetBall = false;
|
||||
}
|
||||
auto ballTransform = m_World->GetComponent<Components::Transform>(entity);
|
||||
ballTransform->Position = m_PadTransform->Position;
|
||||
ballTransform->Position += ball->StickyPlacement;
|
||||
glm::vec2 dir = glm::normalize(glm::vec2(ball->SavedSpeed.x, ball->SavedSpeed.y));
|
||||
glm::vec2 up = glm::vec2(0.f, 1.f);
|
||||
float angle = glm::acos(glm::dot<float>(dir, up)) * glm::sign(dir.x);
|
||||
ballTransform->Orientation = glm::rotate(glm::quat(), angle, glm::vec3(0.f, 0.f, -1.f));
|
||||
if (ball->Sticky) {
|
||||
m_StickTransform->Orientation = glm::rotate(glm::quat(), angle, glm::vec3(0.f, 0.f, 1.f));
|
||||
m_StickTransform->Position = ballTransform->Position;
|
||||
if (ball->Loaded) {
|
||||
ballTransform->Orientation = glm::quat();
|
||||
} else {
|
||||
glm::vec2 dir = glm::normalize(glm::vec2(ball->SavedSpeed.x, ball->SavedSpeed.y));
|
||||
glm::vec2 up = glm::vec2(0.f, 1.f);
|
||||
float angle = glm::acos(glm::dot<float>(dir, up)) * glm::sign(dir.x);
|
||||
ballTransform->Orientation = glm::rotate(glm::quat(), angle, glm::vec3(0.f, 0.f, -1.f));
|
||||
if (ball->Sticky) {
|
||||
m_StickTransform->Orientation = glm::rotate(glm::quat(), angle, glm::vec3(0.f, 0.f, 1.f));
|
||||
m_StickTransform->Position = ballTransform->Position;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!m_StickyAim->Aiming) {
|
||||
m_StickTransform->Position = glm::vec3(30.f, 0.f, 0.f);
|
||||
@@ -287,6 +293,10 @@ bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) {
|
||||
e.Origin1 = glm::vec3(-5, 7, -10);
|
||||
e.Origin2 = glm::vec3(5, 7, -10);
|
||||
e.Set = 1;
|
||||
e.SetCluster = 1;
|
||||
EventBroker->Publish(e);
|
||||
} else if (val == GLFW_KEY_C) {
|
||||
Events::BreakAllBricks e;
|
||||
EventBroker->Publish(e);
|
||||
} else if (val == GLFW_KEY_L) {
|
||||
Events::Lifebuoy e;
|
||||
|
||||
@@ -108,9 +108,20 @@ bool dd::Systems::ProjectileSystem::OnInkBlaster(const dd::Events::InkBlaster &e
|
||||
|
||||
bool dd::Systems::ProjectileSystem::OnHitPad(const dd::Events::HitPad &event)
|
||||
{
|
||||
if (m_InkBlaster) {
|
||||
if (m_InkBlaster && m_AttachedSquid == 0) {
|
||||
auto ball = m_World->GetComponent<Components::Ball>(event.Ball);
|
||||
ball->Loaded = true;
|
||||
m_SquidLoaded = true;
|
||||
m_AttachedSquid = event.Ball;
|
||||
|
||||
|
||||
auto model = m_World->GetComponent<Components::Model>(m_AttachedSquid);
|
||||
model->ModelFile = "Models/Sid/Sid_Shoot.dae";
|
||||
|
||||
auto anim = m_World->GetComponent<Components::Animation>(m_AttachedSquid);
|
||||
anim->Loop = false;
|
||||
anim->Speed = 0.f;
|
||||
anim->Time = 0.f;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -140,18 +151,33 @@ bool dd::Systems::ProjectileSystem::OnActionButton(const dd::Events::ActionButto
|
||||
transform->Velocity = glm::vec3(0, projectile->Speed, 0);
|
||||
m_Shots--;
|
||||
|
||||
auto anim = m_World->GetComponent<Components::Animation>(m_AttachedSquid);
|
||||
anim->Loop = false;
|
||||
anim->Speed = 2.f;
|
||||
anim->Time = 0.f;
|
||||
|
||||
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->Loaded = false;
|
||||
ball->Waiting = true;
|
||||
|
||||
{
|
||||
Events::InkBlasterOver e;
|
||||
e.Ball = m_AttachedSquid;
|
||||
|
||||
EventBroker->Publish(e);
|
||||
|
||||
auto model = m_World->GetComponent<Components::Model>(m_AttachedSquid);
|
||||
model->ModelFile = "Models/Sid/Sid_Flying.dae";
|
||||
|
||||
auto anim = m_World->GetComponent<Components::Animation>(m_AttachedSquid);
|
||||
anim->Loop = true;
|
||||
anim->Speed = 1.f;
|
||||
m_AttachedSquid = 0;
|
||||
}
|
||||
{
|
||||
Events::ActionButton e;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "Game/ScreenShakeSystem.h"
|
||||
|
||||
|
||||
void dd::Systems::ScreenShakeSystem::Initialize()
|
||||
{
|
||||
std::random_device rd;
|
||||
|
||||
@@ -57,7 +57,7 @@ void dd::Systems::WaterSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
if (transform->Position.y < m_SubmergedHeight) {
|
||||
brickPart->Submerged = true;
|
||||
m_BrickPartCounters[brickPart->NumberOfPartsInBrick]++;
|
||||
std::cout << "Parts: " << m_BrickPartCounters[brickPart->NumberOfPartsInBrick] << " of " << brickPart->NumberOfPartsInBrick << std::endl;
|
||||
//std::cout << "Parts: " << m_BrickPartCounters[brickPart->NumberOfPartsInBrick] << " of " << brickPart->NumberOfPartsInBrick << std::endl;
|
||||
if (m_BrickPartCounters[brickPart->NumberOfPartsInBrick] >= brickPart->NumberOfPartsInBrick) {
|
||||
m_BrickPartCounters[brickPart->NumberOfPartsInBrick] = 0;
|
||||
Events::RaiseWater e;
|
||||
|
||||
@@ -592,7 +592,7 @@ void dd::Systems::PhysicsSystem::UpdateParticleEmitters(double dt)
|
||||
|
||||
|
||||
//Random z-value
|
||||
std::uniform_real_distribution<float> dist(0, 1);
|
||||
std::uniform_real_distribution<float> dist(0, 0.1);
|
||||
float zDistribution = dist(gen);
|
||||
particleTransform->Position = glm::vec3(emitterTransform->Position.x, emitterTransform->Position.y, -9.5f + zDistribution);
|
||||
particleTransform->Scale = particleTemplate->Scale;
|
||||
@@ -730,6 +730,7 @@ bool dd::Systems::PhysicsSystem::CreateParticleSequence(const Events::CreatePart
|
||||
particleEmitter->RadiusDistribution = event.RadiusDistribution;
|
||||
particleEmitter->DefaultScale = event.DefaultScale;
|
||||
particleEmitter->ScaleValues = event.ScaleValues;
|
||||
particleEmitter->VelocityValues = event.VelocityValues;
|
||||
{
|
||||
//Creating Particle Template
|
||||
auto particle = m_World->CreateEntity(emitter);
|
||||
|
||||
@@ -42,6 +42,7 @@ void dd::Systems::AnimationSystem::Update(double dt)
|
||||
Events::AnimationComplete e;
|
||||
e.Entity = ent;
|
||||
e.Animation = animationComponent->Name;
|
||||
EventBroker->Publish(e);
|
||||
} else {
|
||||
animationComponent->Time = nextTime;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ void dd::Renderer::Initialize()
|
||||
}
|
||||
|
||||
// Create default camera
|
||||
m_DefaultCamera = std::unique_ptr<dd::Camera>(new dd::Camera((float)m_Resolution.Width / m_Resolution.Height, 45.f, 0.01f, 5000.f));
|
||||
m_DefaultCamera = std::unique_ptr<dd::Camera>(new dd::Camera((float)m_Resolution.Width / m_Resolution.Height, glm::radians(45.f), 0.01f, 5000.f));
|
||||
m_DefaultCamera->SetPosition(glm::vec3(0, 0, 0));
|
||||
if (m_Camera == nullptr) {
|
||||
m_Camera = m_DefaultCamera.get();
|
||||
@@ -391,11 +391,6 @@ void dd::Renderer::DrawForward(RenderQueue &objects, RenderQueue &lights)
|
||||
DrawWater(objects);
|
||||
}
|
||||
|
||||
void dd::Renderer::PlaceCamera(glm::vec3 position)
|
||||
{
|
||||
m_DefaultCamera->SetPosition(position);
|
||||
}
|
||||
|
||||
void dd::Renderer::DrawScene(RenderQueue &objects, ShaderProgram &program)
|
||||
{
|
||||
GLuint shaderProgramHandle = program;
|
||||
|
||||
Reference in New Issue
Block a user