Prepared for Lifebuoy PowerUp.

This commit is contained in:
PlatinumSkink
2015-10-08 11:51:13 +02:00
parent d038855fb7
commit b5ae490b23
6 changed files with 45 additions and 15 deletions
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-09-17.
//
#ifndef DAYDREAM_ELIFEBUOY_H
#define DAYDREAM_ELIFEBUOY_H
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct Lifebuoy : Event
{
Components::Transform* Transform;
};
}
}
#endif //DAYDREAM_ELIFEBUOY_H
+3 -1
View File
@@ -22,13 +22,14 @@
#include "Game/EScoreEvent.h"
#include "Game/EComboEvent.h"
#include "Game/EHitPad.h"
#include "Game/ELifebuoy.h"
#include "Game/EMultiBall.h"
#include "Game/EMultiBallLost.h"
#include "Game/EPause.h"
#include "Game/EGameOver.h"
#include "Game/ECreatePowerUp.h"
#include "Game/EPowerUpTaken.h"
#include "Game/Bricks/CPowerUpBrick.h"
//#include "Game/Bricks/CPowerUpBrick.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Physics/CRectangleShape.h"
@@ -123,6 +124,7 @@ private:
const int EmptyBrickSpace = 0;
const int StandardBrick = 1;
const int MultiBallBrick = 2;
const int LifebuoyBrick = 3;
EntityID m_BrickTemplate;
+1 -1
View File
@@ -104,7 +104,7 @@ namespace dd
dd::EventRelay<PhysicsSystem, dd::Events::StageCleared> m_EStageCleared;
bool OnStageCleared(const dd::Events::StageCleared &event);
bool m_Travelling = false;
float m_Timer = 0;
float m_DistanceTravelled = 0;
//TODO: Fill struct with info needed.
struct ParticleEmitter
+1 -1
View File
@@ -59,7 +59,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, /*45.f*/ 45.f, 0.01f, 5000.f));
m_DefaultCamera->SetPosition(glm::vec3(0, 0, 0));
if (m_Camera == nullptr) {
m_Camera = m_DefaultCamera.get();
+11 -5
View File
@@ -77,12 +77,17 @@ void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID
if (brick != nullptr) {
auto transform = m_World->GetComponent<Components::Transform>(entity);
//Removes bricks that falls out of the stage.
if (transform->Position.y < -10) {
if (brick->Type == MultiBallBrick) {
if (transform->Position.y < -10) {
if (brick->Type == StandardBrick) {
} else if (brick->Type == MultiBallBrick) {
Events::MultiBall e;
e.padTransform = transform;
EventBroker->Publish(e);
}
} else if (brick->Type == LifebuoyBrick) {
Events::Lifebuoy e;
e.Transform = transform;
EventBroker->Publish(e);
}
m_LooseBricks--;
m_World->RemoveEntity(entity);
}
@@ -185,10 +190,11 @@ void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBe
if (typeInt == StandardBrick) {
} else if (typeInt == MultiBallBrick) {
cBrick->Type = MultiBallBrick;
std::shared_ptr<Components::PowerUpBrick> cPow = m_World->AddComponent<Components::PowerUpBrick>(brick);
auto model = m_World->GetComponent<Components::Model>(brick);
model->ModelFile = "Models/Brick/IceBrick.obj";
}
} else if (typeInt == LifebuoyBrick) {
cBrick->Type = LifebuoyBrick;
}
float x = line * spacesBetweenBricks.x;
float y = row * spacesBetweenBricks.y;
transform->Position = glm::vec3(x - 3, 5 - spaceToEdge - y + aboveLevel, -10.f);
+4 -7
View File
@@ -147,11 +147,12 @@ void dd::Systems::PhysicsSystem::Update(double dt)
}
if (m_Travelling) {
m_Timer += dt;
if (m_Timer >= 2) {
m_Timer = 0;
if (m_DistanceTravelled > 12.f) {
m_DistanceTravelled = 0;
m_Travelling = false;
}
m_DistanceTravelled += 6.0f * dt;
}
m_Accumulator += dt;
@@ -209,10 +210,6 @@ void dd::Systems::PhysicsSystem::UpdateEntity(double dt, EntityID entity, Entity
return;
}
transform->Position.y -= 6.0f * dt;
/*auto brick = m_World->GetComponent<Components::Brick>(entity);
if (brick != nullptr) {
}*/
}
}
}