Merge branch 'master' of github.com:teamfisk/AgileBreakOut
This commit is contained in:
+13
-1
@@ -31,14 +31,15 @@
|
||||
//TODO: Remove includes that are only here for the temporary draw solution.
|
||||
#include "World.h"
|
||||
#include "CTransform.h"
|
||||
#include "CTemplate.h"
|
||||
#include "Core/EventBroker.h"
|
||||
#include "Rendering/CModel.h"
|
||||
#include "Rendering/CSprite.h"
|
||||
#include "CTemplate.h"
|
||||
#include "Rendering/CPointLight.h"
|
||||
#include "Transform/TransformSystem.h"
|
||||
#include "Sound/SoundSystem.h"
|
||||
#include "Sound/CCollisionSound.h"
|
||||
|
||||
#include "Game/LevelSystem.h"
|
||||
#include "Game/PadSystem.h"
|
||||
#include "Game/CBall.h"
|
||||
@@ -46,12 +47,15 @@
|
||||
#include "Game/CLifebuoy.h"
|
||||
#include "Game/CProjectile.h"
|
||||
#include "Game/CBrick.h"
|
||||
#include "Game/CStickyAim.h"
|
||||
#include "Game/BallSystem.h"
|
||||
#include "Game/HitLagSystem.h"
|
||||
#include "Game/LifebuoySystem.h"
|
||||
#include "Game/ProjectileSystem.h"
|
||||
#include "Game/Bricks/CPowerUpBrick.h"
|
||||
|
||||
#include "Game/BrickComponents.h"
|
||||
|
||||
#include "Physics/PhysicsSystem.h"
|
||||
#include "Physics/CPhysics.h"
|
||||
#include "Physics/CRectangleShape.h"
|
||||
@@ -116,10 +120,18 @@ public:
|
||||
m_World->ComponentFactory.Register<Components::Life>();
|
||||
m_World->ComponentFactory.Register<Components::Lifebuoy>();
|
||||
m_World->ComponentFactory.Register<Components::Projectile>();
|
||||
m_World->ComponentFactory.Register<Components::StickyAim>();
|
||||
|
||||
m_World->ComponentFactory.Register<Components::PowerUp>();
|
||||
m_World->ComponentFactory.Register<Components::PowerUpBrick>();
|
||||
|
||||
m_World->ComponentFactory.Register<Components::StandardBrick>();
|
||||
m_World->ComponentFactory.Register<Components::MultiBallBrick>();
|
||||
m_World->ComponentFactory.Register<Components::LifebuoyBrick>();
|
||||
m_World->ComponentFactory.Register<Components::StickyBrick>();
|
||||
m_World->ComponentFactory.Register<Components::InkBlasterBrick>();
|
||||
m_World->ComponentFactory.Register<Components::KrakenAttackBrick>();
|
||||
|
||||
m_World->SystemFactory.Register<Systems::LevelSystem>(
|
||||
[this]() { return new Systems::LevelSystem(m_World.get(), m_EventBroker); });
|
||||
m_World->AddSystem<Systems::LevelSystem>();
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Physics/CRectangleShape.h"
|
||||
#include "Physics/EContact.h"
|
||||
#include "Rendering/CModel.h"
|
||||
#include "Rendering/CSprite.h"
|
||||
#include "Rendering/CPointLight.h"
|
||||
#include "Game/CBall.h"
|
||||
#include "Game/CPowerUp.h"
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// Created by Adniklastrator on 2015-10-12.
|
||||
//
|
||||
|
||||
#ifndef DAYDREAM_CBRICKCOMPONENTS_H
|
||||
#define DAYDREAM_CBRICKCOMPONENTS_H
|
||||
|
||||
#include "Game/CStandardBrick.h"
|
||||
#include "Game/CMultiBallBrick.h"
|
||||
#include "Game/CLifebuoyBrick.h"
|
||||
#include "Game/CStickyBrick.h"
|
||||
#include "Game/CInkBlasterBrick.h"
|
||||
#include "Game/CKrakenAttackBrick.h"
|
||||
|
||||
#endif //DAYDREAM_CBRICKCOMPONENTS_H
|
||||
@@ -19,6 +19,15 @@ struct Brick : Component
|
||||
//0 = empty, 1 = normal, 2 = multi-brick, 3 = lifebuoy, 4 = sticky, 5 = blaster, 6 = kraken
|
||||
int Type = 0;
|
||||
bool Removed = false;
|
||||
|
||||
//What number of types each is.
|
||||
const int EmptyBrickSpace = 0;
|
||||
const int StandardBrick = 1;
|
||||
const int MultiBallBrick = 2;
|
||||
const int LifebuoyBrick = 3;
|
||||
const int StickyBrick = 4;
|
||||
const int InkBlasterBrick = 5;
|
||||
const int KrakenAttackBrick = 6;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by Adniklastrator on 2015-10-12.
|
||||
//
|
||||
|
||||
#ifndef DAYDREAM_CINKBLASTERBRICK_H
|
||||
#define DAYDREAM_CINKBLASTERBRICK_H
|
||||
|
||||
#include "Core/Component.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
||||
struct InkBlasterBrick : Component
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //DAYDREAM_CINKBLASTERBRICK_H
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by Adniklastrator on 2015-10-12.
|
||||
//
|
||||
|
||||
#ifndef DAYDREAM_CKRAKENATTACKBRICK_H
|
||||
#define DAYDREAM_CKRAKENATTACKBRICK_H
|
||||
|
||||
#include "Core/Component.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
||||
struct KrakenAttackBrick : Component
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //DAYDREAM_CKRAKENATTACKBRICK_H
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by Adniklastrator on 2015-10-12.
|
||||
//
|
||||
|
||||
#ifndef DAYDREAM_CLIFEBUOYBRICK_H
|
||||
#define DAYDREAM_CLIFEBUOYBRICK_H
|
||||
|
||||
#include "Core/Component.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
||||
struct LifebuoyBrick : Component
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //DAYDREAM_CLIFEBUOYBRICK_H
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by Adniklastrator on 2015-10-12.
|
||||
//
|
||||
|
||||
#ifndef DAYDREAM_CMULTIBALLBRICK_H
|
||||
#define DAYDREAM_CMULTIBALLBRICK_H
|
||||
|
||||
#include "Core/Component.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
||||
struct MultiBallBrick : Component
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //DAYDREAM_CMULTIBALLBRICK_H
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by Adniklastrator on 2015-10-12.
|
||||
//
|
||||
|
||||
#ifndef DAYDREAM_CSTANDARDBRICK_H
|
||||
#define DAYDREAM_CSTANDARDBRICK_H
|
||||
|
||||
#include "Core/Component.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
||||
struct StandardBrick : Component
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //DAYDREAM_CSTANDARDBRICK_H
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by Adniklastrator on 2015-10-12.
|
||||
//
|
||||
|
||||
#ifndef DAYDREAM_CSTICKYAIM_H
|
||||
#define DAYDREAM_CSTICKYAIM_H
|
||||
|
||||
#include "Core/Component.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
||||
struct StickyAim : Component
|
||||
{
|
||||
bool Aiming = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //DAYDREAM_CSTICKYAIM_H
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by Adniklastrator on 2015-10-12.
|
||||
//
|
||||
|
||||
#ifndef DAYDREAM_CSTICKYBRICK_H
|
||||
#define DAYDREAM_CSTICKYBRICK_H
|
||||
|
||||
#include "Core/Component.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
||||
struct StickyBrick : Component
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //DAYDREAM_CSTICKYBRICK_H
|
||||
@@ -12,11 +12,15 @@
|
||||
#include "Core/World.h"
|
||||
#include "Rendering/CSprite.h"
|
||||
#include "Rendering/CModel.h"
|
||||
|
||||
#include "Game/CBrick.h"
|
||||
#include "Game/CBall.h"
|
||||
#include "Game/CLife.h"
|
||||
#include "Game/CProjectile.h"
|
||||
#include "Game/CPowerUp.h"
|
||||
|
||||
#include "Game/BrickComponents.h"
|
||||
|
||||
#include "Game/EStageCleared.h"
|
||||
#include "Game/ELifeLost.h"
|
||||
#include "Game/EResetBall.h"
|
||||
@@ -34,7 +38,7 @@
|
||||
#include "Game/EClusterClear.h"
|
||||
#include "Game/ECreatePowerUp.h"
|
||||
#include "Game/EPowerUpTaken.h"
|
||||
//#include "Game/Bricks/CPowerUpBrick.h"
|
||||
|
||||
#include "Physics/CPhysics.h"
|
||||
#include "Physics/CCircleShape.h"
|
||||
#include "Physics/CRectangleShape.h"
|
||||
|
||||
@@ -24,8 +24,11 @@
|
||||
#include "Game/CBall.h"
|
||||
#include "Game/CPad.h"
|
||||
#include "Game/CPowerUp.h"
|
||||
#include "Game/CStickyAim.h"
|
||||
#include "Game/EResetBall.h"
|
||||
#include "Game/EMultiBall.h"
|
||||
#include "Game/EStickyPad.h"
|
||||
#include "Game/EInkBlaster.h"
|
||||
#include "Game/EKrakenAttack.h"
|
||||
#include "Game/EPowerUpTaken.h"
|
||||
#include "Game/EStageCleared.h"
|
||||
@@ -78,12 +81,15 @@ private:
|
||||
bool m_ReplaceBall = false;
|
||||
bool m_MultiBall = false;
|
||||
bool m_KrakenAttack = false;
|
||||
bool m_BallStuck = false;
|
||||
double m_KrakenCharge = 0;
|
||||
double m_KrakenStrength = 0;
|
||||
double m_PlayerStrength = 0;
|
||||
float m_Edge = 2.8f;
|
||||
Components::Transform* m_Transform = nullptr;
|
||||
Components::Pad* m_Pad = nullptr;
|
||||
std::shared_ptr<Components::Transform> m_StickTransform;
|
||||
std::shared_ptr<Components::StickyAim> m_StickyAim;
|
||||
|
||||
bool m_Pause = false;
|
||||
|
||||
@@ -94,6 +100,7 @@ private:
|
||||
dd::EventRelay<PadSystem, dd::Events::StageCleared> m_EStageCleared;
|
||||
dd::EventRelay<PadSystem, dd::Events::Pause> m_EPause;
|
||||
dd::EventRelay<PadSystem, dd::Events::KrakenAttack> m_EKrakenAttack;
|
||||
dd::EventRelay<PadSystem, dd::Events::StickyPad> m_EStickyPad;
|
||||
dd::EventRelay<PadSystem, dd::Events::ActionButton> m_EActionButton;
|
||||
|
||||
bool OnKeyDown(const dd::Events::KeyDown &event);
|
||||
@@ -103,6 +110,7 @@ private:
|
||||
bool OnStageCleared(const dd::Events::StageCleared &event);
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnKrakenAttack(const dd::Events::KrakenAttack &event);
|
||||
bool OnStickyPad(const dd::Events::StickyPad &event);
|
||||
bool OnActionButton(const dd::Events::ActionButton &event);
|
||||
|
||||
class PadSteeringInputController;
|
||||
|
||||
@@ -195,11 +195,14 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
}
|
||||
|
||||
if (ballComponent != nullptr) {
|
||||
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);
|
||||
transform->Orientation = glm::rotate(glm::quat(), angle, glm::vec3(0.f, 0.f, -1.f));
|
||||
if (!ballComponent->Sticky)
|
||||
{
|
||||
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);
|
||||
transform->Orientation = glm::rotate(glm::quat(), angle, glm::vec3(0.f, 0.f, -1.f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,7 +461,6 @@ bool dd::Systems::BallSystem::OnInkBlasterOver(const dd::Events::InkBlasterOver
|
||||
m_InkBlaster = false;
|
||||
m_InkAttached = false;
|
||||
m_BlockedWaiting = false;
|
||||
m_Sticky = true;
|
||||
ballComponent->SavedSpeed = glm::normalize(glm::vec3(0.f, 1.f, 0.f)) * ballComponent->Speed;
|
||||
m_Waiting = false;
|
||||
transform->Velocity = glm::normalize(glm::vec3(0.f, 1, 0.f)) * ballComponent->Speed;
|
||||
|
||||
@@ -200,21 +200,28 @@ void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBe
|
||||
auto cBrick = m_World->GetComponent<Components::Brick>(brick);
|
||||
auto model = m_World->GetComponent<Components::Model>(brick);
|
||||
if (typeInt == StandardBrick) {
|
||||
cBrick->Type = StandardBrick;
|
||||
auto type = m_World->AddComponent<Components::StandardBrick>(brick);
|
||||
model->Color = colorVec;
|
||||
} else if (typeInt == MultiBallBrick) {
|
||||
cBrick->Type = MultiBallBrick;
|
||||
auto type = m_World->AddComponent<Components::MultiBallBrick>(brick);
|
||||
model->ModelFile = "Models/Brick/IceBrick.obj";
|
||||
} else if (typeInt == LifebuoyBrick) {
|
||||
cBrick->Type = LifebuoyBrick;
|
||||
auto type = m_World->AddComponent<Components::LifebuoyBrick>(brick);
|
||||
model->ModelFile = "Models/Brick/LifeBuoyBrick.obj";
|
||||
} else if (typeInt == StickyBrick) {
|
||||
cBrick->Type = StickyBrick;
|
||||
auto type = m_World->AddComponent<Components::StickyBrick>(brick);
|
||||
model->ModelFile = "Models/Brick/StickyBrick.obj";
|
||||
} else if (typeInt == InkBlasterBrick) {
|
||||
cBrick->Type = InkBlasterBrick;
|
||||
auto type = m_World->AddComponent<Components::InkBlasterBrick>(brick);
|
||||
model->Color = glm::vec4(0.1f, 0.1f, 0.1f, 1.0f);
|
||||
} else if (typeInt == KrakenAttackBrick) {
|
||||
cBrick->Type = KrakenAttackBrick;
|
||||
auto type = m_World->AddComponent<Components::KrakenAttackBrick>(brick);
|
||||
model->Color = glm::vec4(0.f, 0.5f, 1.0f, .0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ void dd::Systems::PadSystem::Initialize()
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &PadSystem::OnStageCleared);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &PadSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &PadSystem::OnKrakenAttack);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EStickyPad, &PadSystem::OnStickyPad);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &PadSystem::OnActionButton);
|
||||
//EVENT_SUBSCRIBE_MEMBER(m_EBindKey, &PadSystem::OnBindKey);
|
||||
|
||||
@@ -53,6 +54,21 @@ void dd::Systems::PadSystem::Initialize()
|
||||
|
||||
SetEdge(3.2 - (ctransform->Scale.x / 2));
|
||||
}
|
||||
|
||||
//Stick
|
||||
{
|
||||
auto ent = m_World->CreateEntity();
|
||||
m_World->SetProperty(ent, "Name", "Stick");
|
||||
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(ent);
|
||||
transform->Position = glm::vec3(30.f, 0.f, -10.f);
|
||||
transform->Scale = glm::vec3(0.1f, 20.f, 0.1f);
|
||||
std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(ent);
|
||||
sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
|
||||
std::shared_ptr<Components::StickyAim> sticky = m_World->AddComponent<Components::StickyAim>(ent);
|
||||
m_World->CommitEntity(ent);
|
||||
|
||||
m_StickTransform = transform;
|
||||
}
|
||||
}
|
||||
|
||||
void dd::Systems::PadSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||
@@ -63,9 +79,21 @@ void dd::Systems::PadSystem::UpdateEntity(double dt, EntityID entity, EntityID p
|
||||
auto ball = m_World->GetComponent<Components::Ball>(entity);
|
||||
if (ball != nullptr) {
|
||||
if (ball->Sticky) {
|
||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||
transform->Position = Transform()->Position;
|
||||
transform->Position += ball->StickyPlacement;
|
||||
auto ballTransform = m_World->GetComponent<Components::Transform>(entity);
|
||||
ballTransform->Position = Transform()->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 (m_StickyAim->Aiming) {
|
||||
m_StickTransform->Orientation = glm::rotate(glm::quat(), angle, glm::vec3(0.f, 0.f, 1.f));
|
||||
m_StickTransform->Position = ballTransform->Position;
|
||||
}*/
|
||||
} else {
|
||||
/*if (!m_StickyAim->Aiming) {
|
||||
m_StickTransform->Position = glm::vec3(30.f, 0.f, 0.f);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,7 +209,15 @@ bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) {
|
||||
} else if (val == GLFW_KEY_S) {
|
||||
Events::StageCleared e;
|
||||
EventBroker->Publish(e);
|
||||
} else if (val == GLFW_KEY_K) {
|
||||
} else if (val == GLFW_KEY_Y) {
|
||||
Events::StickyPad e;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
else if (val == GLFW_KEY_I) {
|
||||
Events::InkBlaster e;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
else if (val == GLFW_KEY_K) {
|
||||
Events::KrakenAttack e;
|
||||
e.ChargeUpdate = 0;
|
||||
e.KrakenStrength = 0.1;
|
||||
@@ -333,6 +369,11 @@ bool dd::Systems::PadSystem::OnKrakenAttack(const dd::Events::KrakenAttack &even
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::PadSystem::OnStickyPad(const dd::Events::StickyPad &event)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::PadSystem::OnActionButton(const dd::Events::ActionButton &event)
|
||||
{
|
||||
if (m_KrakenAttack) {
|
||||
|
||||
Reference in New Issue
Block a user