Merge branch 'master' of github.com:teamfisk/AgileBreakOut into Tobias
|
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 124 B |
@@ -9,4 +9,4 @@ Ks 0.500000 0.500000 0.500000
|
|||||||
Ni 1.000000
|
Ni 1.000000
|
||||||
d 1.000000
|
d 1.000000
|
||||||
illum 2
|
illum 2
|
||||||
map_Kd LifebuoyTexture.png
|
map_Kd LifebuoyTexture1.png
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Blender v2.75 (sub 0) OBJ File: 'Lifebuoy.blend'
|
# Blender v2.75 (sub 0) OBJ File: 'Lifebuoy.blend'
|
||||||
# www.blender.org
|
# www.blender.org
|
||||||
mtllib Lifebuoy.mtl
|
mtllib Lifebuoy1.mtl
|
||||||
o Torus
|
o Torus
|
||||||
v 0.428934 0.000000 0.162495
|
v 0.428934 0.000000 0.162495
|
||||||
v 0.425944 0.009662 0.167205
|
v 0.425944 0.009662 0.167205
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# Blender MTL File: 'Lifebuoy.blend'
|
||||||
|
# Material Count: 1
|
||||||
|
|
||||||
|
newmtl Material.001
|
||||||
|
Ns 96.078431
|
||||||
|
Ka 0.000000 0.000000 0.000000
|
||||||
|
Kd 0.640000 0.640000 0.640000
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ni 1.000000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
map_Kd LifebuoyTexture2.png
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# Blender MTL File: 'Lifebuoy.blend'
|
||||||
|
# Material Count: 1
|
||||||
|
|
||||||
|
newmtl Material.001
|
||||||
|
Ns 96.078431
|
||||||
|
Ka 0.000000 0.000000 0.000000
|
||||||
|
Kd 0.640000 0.640000 0.640000
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ni 1.000000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
map_Kd LifebuoyTexture3.png
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# Blender MTL File: 'Lifebuoy.blend'
|
||||||
|
# Material Count: 1
|
||||||
|
|
||||||
|
newmtl Material.001
|
||||||
|
Ns 96.078431
|
||||||
|
Ka 0.000000 0.000000 0.000000
|
||||||
|
Kd 0.640000 0.640000 0.640000
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ni 1.000000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
map_Kd LifebuoyTexture4.png
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# Blender MTL File: 'Lifebuoy.blend'
|
||||||
|
# Material Count: 1
|
||||||
|
|
||||||
|
newmtl Material.001
|
||||||
|
Ns 96.078431
|
||||||
|
Ka 0.000000 0.000000 0.000000
|
||||||
|
Kd 0.640000 0.640000 0.640000
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ni 1.000000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
map_Kd LifebuoyTexture5.png
|
||||||
|
After Width: | Height: | Size: 133 B |
|
After Width: | Height: | Size: 139 B |
|
After Width: | Height: | Size: 135 B |
|
After Width: | Height: | Size: 142 B |
|
After Width: | Height: | Size: 130 B |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 56 KiB |
@@ -29,7 +29,8 @@
|
|||||||
#include "Game/EHitPad.h"
|
#include "Game/EHitPad.h"
|
||||||
#include "Game/EHitLag.h"
|
#include "Game/EHitLag.h"
|
||||||
#include "Game/EActionButton.h"
|
#include "Game/EActionButton.h"
|
||||||
#include "Game/CLifebuoy.h"
|
#include "Game/CLifebuoy.h"
|
||||||
|
#include "Game/ELifebuoyHit.h"
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Components
|
|||||||
|
|
||||||
struct Lifebuoy : Component
|
struct Lifebuoy : Component
|
||||||
{
|
{
|
||||||
|
int Hits = 4;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#ifndef DAYDREAM_ECLUSTERCLEAR_H
|
||||||
|
#define DAYDREAM_ECLUSTERCLEAR_H
|
||||||
|
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
#include "Core/Entity.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Events
|
||||||
|
{
|
||||||
|
|
||||||
|
struct ClusterClear : Event
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_ECLUSTERCLEAR_H
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// Created by Adniklastrator on 2015-09-29.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_ELIFEBUOYHIT_H
|
||||||
|
#define DAYDREAM_ELIFEBUOYHIT_H
|
||||||
|
|
||||||
|
#include "Core/Entity.h"
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Events
|
||||||
|
{
|
||||||
|
|
||||||
|
struct LifebuoyHit : Event
|
||||||
|
{
|
||||||
|
EntityID Lifebuoy;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_ELIFEBUOYHIT_H
|
||||||
@@ -7,6 +7,8 @@
|
|||||||
#include "Core/EKeyUp.h"
|
#include "Core/EKeyUp.h"
|
||||||
#include "Game/EScoreEvent.h"
|
#include "Game/EScoreEvent.h"
|
||||||
#include "Game/FPSCounter.h"
|
#include "Game/FPSCounter.h"
|
||||||
|
#include "Game/EGameOver.h"
|
||||||
|
#include "Game/EClusterClear.h"
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
{
|
{
|
||||||
@@ -44,6 +46,8 @@ public:
|
|||||||
m_FPSCounter = new GUI::FPSCounter(this, "FPSCounter");
|
m_FPSCounter = new GUI::FPSCounter(this, "FPSCounter");
|
||||||
|
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EScore, &HUD::OnScore);
|
EVENT_SUBSCRIBE_MEMBER(m_EScore, &HUD::OnScore);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EGameOver, &HUD::OnGameOver);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_ClusterClear, &HUD::OnClusterClear);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -53,14 +57,32 @@ private:
|
|||||||
NumberFrame* m_StageNumberFrame = nullptr;
|
NumberFrame* m_StageNumberFrame = nullptr;
|
||||||
NumberFrame* m_ScoreNumberFrame = nullptr;
|
NumberFrame* m_ScoreNumberFrame = nullptr;
|
||||||
FPSCounter* m_FPSCounter = nullptr;
|
FPSCounter* m_FPSCounter = nullptr;
|
||||||
|
TextureFrame* m_GameOverFrame = nullptr;
|
||||||
|
TextureFrame* m_ClusterClearFrame = nullptr;
|
||||||
|
|
||||||
EventRelay<Frame, Events::ScoreEvent> m_EScore;
|
EventRelay<Frame, Events::ScoreEvent> m_EScore;
|
||||||
|
EventRelay<Frame, Events::GameOver> m_EGameOver;
|
||||||
|
EventRelay<Frame, Events::ClusterClear> m_ClusterClear;
|
||||||
|
|
||||||
bool OnScore(const Events::ScoreEvent& event)
|
bool OnScore(const Events::ScoreEvent& event)
|
||||||
{
|
{
|
||||||
m_ScoreNumberFrame->SetNumber(m_ScoreNumberFrame->Number() + event.Score);
|
m_ScoreNumberFrame->SetNumber(m_ScoreNumberFrame->Number() + event.Score);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OnGameOver(const Events::GameOver& event)
|
||||||
|
{
|
||||||
|
m_GameOverFrame = new GUI::TextureFrame(this, "HUDGameOverFrame");
|
||||||
|
m_GameOverFrame->SetTexture("Textures/GUI/HUD/GameOverScreen.png");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OnClusterClear(const Events::ClusterClear& event)
|
||||||
|
{
|
||||||
|
m_ClusterClearFrame = new GUI::TextureFrame(this, "HUDGameOverFrame");
|
||||||
|
m_ClusterClearFrame->SetTexture("Textures/GUI/HUD/WinScreen.png");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "Game/EMultiBallLost.h"
|
#include "Game/EMultiBallLost.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
#include "Game/EGameOver.h"
|
#include "Game/EGameOver.h"
|
||||||
|
#include "Game/EClusterClear.h"
|
||||||
#include "Game/ECreatePowerUp.h"
|
#include "Game/ECreatePowerUp.h"
|
||||||
#include "Game/EPowerUpTaken.h"
|
#include "Game/EPowerUpTaken.h"
|
||||||
//#include "Game/Bricks/CPowerUpBrick.h"
|
//#include "Game/Bricks/CPowerUpBrick.h"
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "Physics/CRectangleShape.h"
|
#include "Physics/CRectangleShape.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
#include "Game/ELifebuoy.h"
|
#include "Game/ELifebuoy.h"
|
||||||
|
#include "Game/ELifebuoyHit.h"
|
||||||
#include "Game/CLifebuoy.h"
|
#include "Game/CLifebuoy.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -48,19 +49,22 @@ 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::Lifebuoy> m_ELifebuoy;
|
dd::EventRelay<LifebuoySystem, dd::Events::Lifebuoy> m_ELifebuoy;
|
||||||
|
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 OnLifebuoy(const dd::Events::Lifebuoy &event);
|
bool OnLifebuoy(const dd::Events::Lifebuoy &event);
|
||||||
|
bool OnLifebuoyHit(const dd::Events::LifebuoyHit &event);
|
||||||
|
|
||||||
struct LifebuoyInfo
|
struct LifebuoyInfo
|
||||||
{
|
{
|
||||||
EntityID Entity;
|
EntityID Entity;
|
||||||
float TimeToLive = 15.f;
|
//int Hits = 4;
|
||||||
};
|
};
|
||||||
|
|
||||||
float m_LeftEdge = -3.8f;
|
float m_LeftEdge = -3.8f;
|
||||||
float m_RightEdge = 3.8f;
|
float m_RightEdge = 3.8f;
|
||||||
|
float m_DownLimit = -5.3f;
|
||||||
float m_DownEdge = -9.2f;
|
float m_DownEdge = -9.2f;
|
||||||
std::list<LifebuoyInfo> m_Lifebuoys;
|
std::list<LifebuoyInfo> m_Lifebuoys;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,11 +63,17 @@ void dd::Systems::BallSystem::Initialize()
|
|||||||
|
|
||||||
void dd::Systems::BallSystem::Update(double dt)
|
void dd::Systems::BallSystem::Update(double dt)
|
||||||
{
|
{
|
||||||
if (Lives() < 0)
|
if (Lives() == 0)
|
||||||
{
|
{
|
||||||
SetLives(3);
|
|
||||||
Events::GameOver e;
|
Events::GameOver e;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
|
|
||||||
|
Events::Pause p;
|
||||||
|
p.Type = "All";
|
||||||
|
EventBroker->Publish(p);
|
||||||
|
|
||||||
|
//TODO: Make this not so ugly
|
||||||
|
SetLives(-1);
|
||||||
}
|
}
|
||||||
ResolveContacts();
|
ResolveContacts();
|
||||||
}
|
}
|
||||||
@@ -305,7 +311,9 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event)
|
|||||||
} // Lifebuoy should always reflect the ball upwards
|
} // Lifebuoy should always reflect the ball upwards
|
||||||
else if (m_World->GetProperty<std::string>(otherEntitiy, "Name") == "Lifebuoy"){
|
else if (m_World->GetProperty<std::string>(otherEntitiy, "Name") == "Lifebuoy"){
|
||||||
ballTransform->Velocity = glm::vec3(ballTransform->Velocity.x, abs(ballTransform->Velocity.y), ballTransform->Velocity.z);
|
ballTransform->Velocity = glm::vec3(ballTransform->Velocity.x, abs(ballTransform->Velocity.y), ballTransform->Velocity.z);
|
||||||
|
Events::LifebuoyHit e;
|
||||||
|
e.Lifebuoy = otherEntitiy;
|
||||||
|
EventBroker->Publish(e);
|
||||||
} else {
|
} else {
|
||||||
auto it = m_Contacts.find(ballEntity);
|
auto it = m_Contacts.find(ballEntity);
|
||||||
if (it == m_Contacts.end()) {
|
if (it == m_Contacts.end()) {
|
||||||
|
|||||||
@@ -443,7 +443,15 @@ bool dd::Systems::LevelSystem::OnStageCleared(const dd::Events::StageCleared &ev
|
|||||||
if (m_CurrentLevel < 6) {
|
if (m_CurrentLevel < 6) {
|
||||||
GetNextLevel();
|
GetNextLevel();
|
||||||
CreateLevel(12);
|
CreateLevel(12);
|
||||||
}
|
} else {
|
||||||
|
// Win
|
||||||
|
Events::ClusterClear e;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
|
||||||
|
Events::Pause p;
|
||||||
|
p.Type = "All";
|
||||||
|
EventBroker->Publish(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,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_ELifebuoy, &LifebuoySystem::OnLifebuoy);
|
EVENT_SUBSCRIBE_MEMBER(m_ELifebuoy, &LifebuoySystem::OnLifebuoy);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_ELifebuoyHit, &LifebuoySystem::OnLifebuoyHit);
|
||||||
|
|
||||||
//Lifebuoy
|
//Lifebuoy
|
||||||
{
|
{
|
||||||
@@ -30,7 +31,7 @@ void dd::Systems::LifebuoySystem::Initialize()
|
|||||||
physics->GravityScale = 1;
|
physics->GravityScale = 1;
|
||||||
ctransform->Sticky = true;
|
ctransform->Sticky = true;
|
||||||
auto cModel = m_World->AddComponent<Components::Model>(ent);
|
auto cModel = m_World->AddComponent<Components::Model>(ent);
|
||||||
cModel->ModelFile = "Models/Lifebuoy/Lifebuoy.obj";
|
cModel->ModelFile = "Models/Lifebuoy/Lifebuoy1.obj";
|
||||||
auto lifebuoy = m_World->AddComponent<Components::Lifebuoy>(ent);
|
auto lifebuoy = m_World->AddComponent<Components::Lifebuoy>(ent);
|
||||||
|
|
||||||
m_World->CommitEntity(ent);
|
m_World->CommitEntity(ent);
|
||||||
@@ -44,8 +45,9 @@ void dd::Systems::LifebuoySystem::Initialize()
|
|||||||
void dd::Systems::LifebuoySystem::Update(double dt)
|
void dd::Systems::LifebuoySystem::Update(double dt)
|
||||||
{
|
{
|
||||||
for (auto it = m_Lifebuoys.begin(); it != m_Lifebuoys.end();) {
|
for (auto it = m_Lifebuoys.begin(); it != m_Lifebuoys.end();) {
|
||||||
it->TimeToLive -= dt;
|
|
||||||
auto transformComponent = m_World->GetComponent<Components::Transform>(it->Entity);
|
auto transformComponent = m_World->GetComponent<Components::Transform>(it->Entity);
|
||||||
|
auto lifebuoyComponent = m_World->GetComponent<Components::Lifebuoy>(it->Entity);
|
||||||
|
|
||||||
if (transformComponent->Position.y < m_DownEdge) {
|
if (transformComponent->Position.y < m_DownEdge) {
|
||||||
m_World->RemoveEntity(it->Entity);
|
m_World->RemoveEntity(it->Entity);
|
||||||
@@ -57,14 +59,20 @@ void dd::Systems::LifebuoySystem::Update(double dt)
|
|||||||
transformComponent->Position = glm::vec3(m_LeftEdge + 0.1f, transformComponent->Position.y, transformComponent->Position.z);
|
transformComponent->Position = glm::vec3(m_LeftEdge + 0.1f, transformComponent->Position.y, transformComponent->Position.z);
|
||||||
} else if (transformComponent->Position.x < m_LeftEdge) {
|
} else if (transformComponent->Position.x < m_LeftEdge) {
|
||||||
transformComponent->Position = glm::vec3(m_RightEdge - 0.1f, transformComponent->Position.y, transformComponent->Position.z);
|
transformComponent->Position = glm::vec3(m_RightEdge - 0.1f, transformComponent->Position.y, transformComponent->Position.z);
|
||||||
} else if (it->TimeToLive < 0.f) {
|
}
|
||||||
|
|
||||||
|
if (lifebuoyComponent->Hits <= 0) {
|
||||||
auto physicsComponent = m_World->GetComponent<Components::Physics>(it->Entity);
|
auto physicsComponent = m_World->GetComponent<Components::Physics>(it->Entity);
|
||||||
physicsComponent->Mask = CollisionLayer::Type::LifeBuoy;
|
physicsComponent->Mask = CollisionLayer::Type::LifeBuoy;
|
||||||
physicsComponent->GravityScale = 10.f;
|
physicsComponent->GravityScale = 10.f;
|
||||||
|
|
||||||
auto modelComponent = m_World->GetComponent<Components::Model>(it->Entity);
|
auto modelComponent = m_World->GetComponent<Components::Model>(it->Entity);
|
||||||
modelComponent->Color = glm::vec4(0.5f, 0.5f, 0.5f, 0.f);
|
modelComponent->Color = glm::vec4(0.5f, 0.5f, 0.5f, 0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (transformComponent->Position.y < m_DownLimit && lifebuoyComponent->Hits > 0) {
|
||||||
|
transformComponent->Position.y = m_DownLimit;
|
||||||
|
}
|
||||||
|
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,3 +124,12 @@ bool dd::Systems::LifebuoySystem::OnLifebuoy(const dd::Events::Lifebuoy &event)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::LifebuoySystem::OnLifebuoyHit(const dd::Events::LifebuoyHit &event)
|
||||||
|
{
|
||||||
|
auto lifebuoyComponent = m_World->GetComponent<Components::Lifebuoy>(event.Lifebuoy);
|
||||||
|
lifebuoyComponent->Hits -= 1;
|
||||||
|
auto modelComponent = m_World->GetComponent<Components::Model>(event.Lifebuoy);
|
||||||
|
modelComponent->ModelFile = "Models/Lifebuoy/Lifebuoy" + std::to_string(5 - lifebuoyComponent->Hits) + ".obj";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||