Merge branch 'master' of github.com:teamfisk/AgileBreakOut into Tobias

This commit is contained in:
tleety
2015-10-08 23:37:14 +02:00
28 changed files with 12208 additions and 13 deletions
Binary file not shown.

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
d 1.000000
illum 2
map_Kd LifebuoyTexture.png
map_Kd LifebuoyTexture1.png
@@ -1,6 +1,6 @@
# Blender v2.75 (sub 0) OBJ File: 'Lifebuoy.blend'
# www.blender.org
mtllib Lifebuoy.mtl
mtllib Lifebuoy1.mtl
o Torus
v 0.428934 0.000000 0.162495
v 0.425944 0.009662 0.167205
+12
View File
@@ -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
File diff suppressed because it is too large Load Diff
+12
View File
@@ -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
File diff suppressed because it is too large Load Diff
+12
View File
@@ -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
File diff suppressed because it is too large Load Diff
+12
View File
@@ -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
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

+1
View File
@@ -30,6 +30,7 @@
#include "Game/EHitLag.h"
#include "Game/EActionButton.h"
#include "Game/CLifebuoy.h"
#include "Game/ELifebuoyHit.h"
namespace dd
{
+1 -1
View File
@@ -15,7 +15,7 @@ namespace Components
struct Lifebuoy : Component
{
int Hits = 4;
};
}
+22
View File
@@ -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
+26
View File
@@ -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
+22
View File
@@ -7,6 +7,8 @@
#include "Core/EKeyUp.h"
#include "Game/EScoreEvent.h"
#include "Game/FPSCounter.h"
#include "Game/EGameOver.h"
#include "Game/EClusterClear.h"
namespace dd
{
@@ -44,6 +46,8 @@ public:
m_FPSCounter = new GUI::FPSCounter(this, "FPSCounter");
EVENT_SUBSCRIBE_MEMBER(m_EScore, &HUD::OnScore);
EVENT_SUBSCRIBE_MEMBER(m_EGameOver, &HUD::OnGameOver);
EVENT_SUBSCRIBE_MEMBER(m_ClusterClear, &HUD::OnClusterClear);
}
private:
@@ -53,14 +57,32 @@ private:
NumberFrame* m_StageNumberFrame = nullptr;
NumberFrame* m_ScoreNumberFrame = nullptr;
FPSCounter* m_FPSCounter = nullptr;
TextureFrame* m_GameOverFrame = nullptr;
TextureFrame* m_ClusterClearFrame = nullptr;
EventRelay<Frame, Events::ScoreEvent> m_EScore;
EventRelay<Frame, Events::GameOver> m_EGameOver;
EventRelay<Frame, Events::ClusterClear> m_ClusterClear;
bool OnScore(const Events::ScoreEvent& event)
{
m_ScoreNumberFrame->SetNumber(m_ScoreNumberFrame->Number() + event.Score);
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;
}
};
}
+1
View File
@@ -30,6 +30,7 @@
#include "Game/EMultiBallLost.h"
#include "Game/EPause.h"
#include "Game/EGameOver.h"
#include "Game/EClusterClear.h"
#include "Game/ECreatePowerUp.h"
#include "Game/EPowerUpTaken.h"
//#include "Game/Bricks/CPowerUpBrick.h"
+5 -1
View File
@@ -16,6 +16,7 @@
#include "Physics/CRectangleShape.h"
#include "Game/EPause.h"
#include "Game/ELifebuoy.h"
#include "Game/ELifebuoyHit.h"
#include "Game/CLifebuoy.h"
#include <fstream>
#include <iostream>
@@ -48,19 +49,22 @@ private:
dd::EventRelay<LifebuoySystem, dd::Events::Contact> m_EContact;
dd::EventRelay<LifebuoySystem, dd::Events::Pause> m_EPause;
dd::EventRelay<LifebuoySystem, dd::Events::Lifebuoy> m_ELifebuoy;
dd::EventRelay<LifebuoySystem, dd::Events::LifebuoyHit> m_ELifebuoyHit;
bool OnContact(const dd::Events::Contact &event);
bool OnPause(const dd::Events::Pause &event);
bool OnLifebuoy(const dd::Events::Lifebuoy &event);
bool OnLifebuoyHit(const dd::Events::LifebuoyHit &event);
struct LifebuoyInfo
{
EntityID Entity;
float TimeToLive = 15.f;
//int Hits = 4;
};
float m_LeftEdge = -3.8f;
float m_RightEdge = 3.8f;
float m_DownLimit = -5.3f;
float m_DownEdge = -9.2f;
std::list<LifebuoyInfo> m_Lifebuoys;
};
+11 -3
View File
@@ -63,11 +63,17 @@ void dd::Systems::BallSystem::Initialize()
void dd::Systems::BallSystem::Update(double dt)
{
if (Lives() < 0)
if (Lives() == 0)
{
SetLives(3);
Events::GameOver e;
EventBroker->Publish(e);
Events::Pause p;
p.Type = "All";
EventBroker->Publish(p);
//TODO: Make this not so ugly
SetLives(-1);
}
ResolveContacts();
}
@@ -305,7 +311,9 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event)
} // Lifebuoy should always reflect the ball upwards
else if (m_World->GetProperty<std::string>(otherEntitiy, "Name") == "Lifebuoy"){
ballTransform->Velocity = glm::vec3(ballTransform->Velocity.x, abs(ballTransform->Velocity.y), ballTransform->Velocity.z);
Events::LifebuoyHit e;
e.Lifebuoy = otherEntitiy;
EventBroker->Publish(e);
} else {
auto it = m_Contacts.find(ballEntity);
if (it == m_Contacts.end()) {
+8
View File
@@ -443,6 +443,14 @@ bool dd::Systems::LevelSystem::OnStageCleared(const dd::Events::StageCleared &ev
if (m_CurrentLevel < 6) {
GetNextLevel();
CreateLevel(12);
} else {
// Win
Events::ClusterClear e;
EventBroker->Publish(e);
Events::Pause p;
p.Type = "All";
EventBroker->Publish(p);
}
}
return true;
+21 -4
View File
@@ -12,6 +12,7 @@ void dd::Systems::LifebuoySystem::Initialize()
EVENT_SUBSCRIBE_MEMBER(m_EContact, &LifebuoySystem::OnContact);
EVENT_SUBSCRIBE_MEMBER(m_EPause, &LifebuoySystem::OnPause);
EVENT_SUBSCRIBE_MEMBER(m_ELifebuoy, &LifebuoySystem::OnLifebuoy);
EVENT_SUBSCRIBE_MEMBER(m_ELifebuoyHit, &LifebuoySystem::OnLifebuoyHit);
//Lifebuoy
{
@@ -30,7 +31,7 @@ void dd::Systems::LifebuoySystem::Initialize()
physics->GravityScale = 1;
ctransform->Sticky = true;
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);
m_World->CommitEntity(ent);
@@ -44,8 +45,9 @@ void dd::Systems::LifebuoySystem::Initialize()
void dd::Systems::LifebuoySystem::Update(double dt)
{
for (auto it = m_Lifebuoys.begin(); it != m_Lifebuoys.end();) {
it->TimeToLive -= dt;
auto transformComponent = m_World->GetComponent<Components::Transform>(it->Entity);
auto lifebuoyComponent = m_World->GetComponent<Components::Lifebuoy>(it->Entity);
if (transformComponent->Position.y < m_DownEdge) {
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);
} else if (transformComponent->Position.x < m_LeftEdge) {
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);
physicsComponent->Mask = CollisionLayer::Type::LifeBuoy;
physicsComponent->GravityScale = 10.f;
auto modelComponent = m_World->GetComponent<Components::Model>(it->Entity);
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;
}
}
@@ -116,3 +124,12 @@ bool dd::Systems::LifebuoySystem::OnLifebuoy(const dd::Events::Lifebuoy &event)
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;
}