Implimented the basis for Kraken encounter.
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
#include "Game/CProjectile.h"
|
||||
#include "Game/CBrick.h"
|
||||
#include "Game/CWall.h"
|
||||
#include "Game/CKraken.h"
|
||||
#include "Game/CBackground.h"
|
||||
#include "Game/CTravels.h"
|
||||
#include "Game/CStickyAim.h"
|
||||
@@ -56,6 +57,7 @@
|
||||
#include "Game/TravellingSystem.h"
|
||||
#include "Game/LifebuoySystem.h"
|
||||
#include "Game/ProjectileSystem.h"
|
||||
#include "Game/KrakenSystem.h"
|
||||
#include "Game/Bricks/CPowerUpBrick.h"
|
||||
|
||||
#include "Game/BrickComponents.h"
|
||||
@@ -128,6 +130,7 @@ public:
|
||||
m_World->ComponentFactory.Register<Components::Life>();
|
||||
m_World->ComponentFactory.Register<Components::Lifebuoy>();
|
||||
m_World->ComponentFactory.Register<Components::Projectile>();
|
||||
m_World->ComponentFactory.Register<Components::Kraken>();
|
||||
m_World->ComponentFactory.Register<Components::StickyAim>();
|
||||
m_World->ComponentFactory.Register<Components::Travels>();
|
||||
|
||||
@@ -165,6 +168,9 @@ public:
|
||||
m_World->SystemFactory.Register<Systems::TravellingSystem>(
|
||||
[this]() { return new Systems::TravellingSystem(m_World.get(), m_EventBroker); });
|
||||
m_World->AddSystem<Systems::TravellingSystem>();
|
||||
m_World->SystemFactory.Register<Systems::KrakenSystem>(
|
||||
[this]() { return new Systems::KrakenSystem(m_World.get(), m_EventBroker); });
|
||||
m_World->AddSystem<Systems::KrakenSystem>();
|
||||
|
||||
m_World->ComponentFactory.Register<Components::Model>();
|
||||
m_World->ComponentFactory.Register<Components::Template>();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//
|
||||
// Created by Adniklastrator on 2015-09-15.
|
||||
// Created by Adniklastrator on 2015-10-15.
|
||||
//
|
||||
|
||||
#ifndef DAYDREAM_CLIFE_H
|
||||
#define DAYDREAM_CLIFE_H
|
||||
#ifndef DAYDREAM_CKRAKEN_H
|
||||
#define DAYDREAM_CKRAKEN_H
|
||||
|
||||
#include "Core/Component.h"
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace dd
|
||||
namespace Components
|
||||
{
|
||||
|
||||
struct Life : Component {
|
||||
struct Kraken : Component {
|
||||
|
||||
int Number = 0;
|
||||
int Health = 10;
|
||||
|
||||
};
|
||||
|
||||
@@ -23,4 +23,4 @@ struct Life : Component {
|
||||
|
||||
}
|
||||
|
||||
#endif //DAYDREAM_CLIFE_H
|
||||
#endif //DAYDREAM_CKRAKEN_H
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Created by Adniklastrator on 2015-10-15.
|
||||
//
|
||||
|
||||
#ifndef DAYDREAM_EKRAKENAPPEAR_H
|
||||
#define DAYDREAM_EKRAKENAPPEAR_H
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct KrakenAppear : Event
|
||||
{
|
||||
int Health;
|
||||
glm::vec3 Position;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //DAYDREAM_EKRAKENAPPEAR_H
|
||||
@@ -11,7 +11,16 @@
|
||||
#include "Core/CTemplate.h"
|
||||
#include "Core/EventBroker.h"
|
||||
#include "Core/World.h"
|
||||
#include "Rendering/CModel.h"
|
||||
#include "Physics/CRectangleShape.h"
|
||||
#include "Physics/CCircleShape.h"
|
||||
#include "Physics/CPhysics.h"
|
||||
#include "Game/EPause.h"
|
||||
#include "Game/EKrakenAppear.h"
|
||||
#include "Game/EKrakenAttack.h"
|
||||
#include "Game/CTravels.h"
|
||||
#include "Game/CKraken.h"
|
||||
#include "Sound/CCollisionSound.h"
|
||||
//#include "Core/Camera.h" Camera Component
|
||||
|
||||
|
||||
@@ -37,9 +46,14 @@ public:
|
||||
void SetPause(const bool& pause) { m_Pause = pause; }
|
||||
private:
|
||||
bool m_Pause = false;
|
||||
EntityID m_KrakenTemplate;
|
||||
|
||||
dd::EventRelay<KrakenSystem, dd::Events::Pause> m_EPause;
|
||||
dd::EventRelay<KrakenSystem, dd::Events::KrakenAppear> m_EKrakenAppear;
|
||||
dd::EventRelay<KrakenSystem, dd::Events::KrakenAttack> m_EKrakenAttack;
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnKrakenAppear(const dd::Events::KrakenAppear &event);
|
||||
bool OnKrakenAttack(const dd::Events::KrakenAttack &event);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
#include "Game/ECreatePowerUp.h"
|
||||
#include "Game/EPowerUpTaken.h"
|
||||
|
||||
#include "Game/EKrakenAppear.h"
|
||||
|
||||
#include "Physics/CPhysics.h"
|
||||
#include "Physics/CCircleShape.h"
|
||||
#include "Physics/CRectangleShape.h"
|
||||
@@ -133,7 +135,7 @@ private:
|
||||
bool m_Initialized = false;
|
||||
bool m_Pause = false;
|
||||
int m_LooseBricks = 0;
|
||||
int m_CurrentCluster = 1;
|
||||
int m_CurrentCluster = 0;
|
||||
int m_CurrentLevel = 1;
|
||||
int m_MultiBalls = 0;
|
||||
int m_PowerUps = 0;
|
||||
@@ -153,6 +155,8 @@ private:
|
||||
const int InkBlasterBrick = 5;
|
||||
const int KrakenAttackBrick = 6;
|
||||
|
||||
const int Kraken = 100;
|
||||
|
||||
EntityID m_BrickTemplate;
|
||||
|
||||
std::array<int, 42> m_Bricks;
|
||||
|
||||
@@ -8,6 +8,33 @@
|
||||
void dd::Systems::KrakenSystem::Initialize()
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &KrakenSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAppear, &KrakenSystem::OnKrakenAppear);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &KrakenSystem::OnKrakenAttack);
|
||||
|
||||
EntityID ent = m_World->CreateEntity();
|
||||
auto transform = m_World->AddComponent<Components::Transform>(ent);
|
||||
auto model = m_World->AddComponent<Components::Model>(ent);
|
||||
std::shared_ptr<Components::CircleShape> cCircle = m_World->AddComponent<Components::CircleShape>(ent);
|
||||
cCircle->Radius = 2;
|
||||
std::shared_ptr<Components::Physics> cPhys = m_World->AddComponent<Components::Physics>(ent);
|
||||
std::shared_ptr<Components::Template> cTemplate = m_World->AddComponent<Components::Template>(ent);
|
||||
|
||||
auto travels = m_World->AddComponent<Components::Travels>(ent);
|
||||
travels->CurrentlyTraveling = false;
|
||||
|
||||
cPhys->CollisionType = CollisionType::Type::Static;
|
||||
cPhys->GravityScale = 0.f;
|
||||
cPhys->Category = CollisionLayer::Type::Brick;
|
||||
cPhys->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Type::Ball | CollisionLayer::Type::Projectile | CollisionLayer::Type::Wall | CollisionLayer::LifeBuoy);
|
||||
|
||||
model->ModelFile = "Models/Test/Ball/Sid.obj";
|
||||
transform->Position = glm::vec3(50, 50, -10);
|
||||
//sound
|
||||
auto collisionSound = m_World->AddComponent<Components::CollisionSound>(ent);
|
||||
collisionSound->FilePath = "Sounds/Brick/shortbrickbreak.wav";
|
||||
m_World->CommitEntity(ent);
|
||||
|
||||
m_KrakenTemplate = ent;
|
||||
|
||||
InitializeObjects();
|
||||
}
|
||||
@@ -34,3 +61,18 @@ bool dd::Systems::KrakenSystem::OnPause(const dd::Events::Pause &event)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::KrakenSystem::OnKrakenAppear(const dd::Events::KrakenAppear &event)
|
||||
{
|
||||
auto ent = m_World->CloneEntity(m_KrakenTemplate);
|
||||
m_World->RemoveComponent<Components::Template>(ent);
|
||||
auto transform = m_World->GetComponent<Components::Transform>(ent);
|
||||
transform->Position = event.Position;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::KrakenSystem::OnKrakenAttack(const dd::Events::KrakenAttack &event)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -400,6 +400,11 @@ void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBe
|
||||
auto transform = m_World->GetComponent<Components::Transform>(brick);
|
||||
auto cBrick = m_World->GetComponent<Components::Brick>(brick);
|
||||
auto model = m_World->GetComponent<Components::Model>(brick);
|
||||
|
||||
float x = line * spacesBetweenBricks.x;
|
||||
float y = row * spacesBetweenBricks.y;
|
||||
transform->Position = glm::vec3(x - 3, 5 - spaceToEdge - y + aboveLevel, -10.f);
|
||||
|
||||
if (typeInt == StandardBrick) {
|
||||
cBrick->Type = StandardBrick;
|
||||
auto type = m_World->AddComponent<Components::StandardBrick>(brick);
|
||||
@@ -425,12 +430,15 @@ void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBe
|
||||
cBrick->Type = KrakenAttackBrick;
|
||||
auto type = m_World->AddComponent<Components::KrakenAttackBrick>(brick);
|
||||
model->Color = glm::vec4(0.f, 0.5f, 1.0f, .0f);
|
||||
} else if (typeInt == Kraken) {
|
||||
Events::KrakenAppear e;
|
||||
e.Position = transform->Position;
|
||||
e.Health = 10;
|
||||
EventBroker->Publish(e);
|
||||
m_World->RemoveEntity(brick);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
float x = line * spacesBetweenBricks.x;
|
||||
float y = row * spacesBetweenBricks.y;
|
||||
transform->Position = glm::vec3(x - 3, 5 - spaceToEdge - y + aboveLevel, -10.f);
|
||||
cBrick->Score = 10 * num;
|
||||
return;
|
||||
}
|
||||
@@ -700,6 +708,8 @@ void dd::Systems::LevelSystem::GetNextLevel()
|
||||
// 5 is ink blaster brick.
|
||||
// 6 is kraken attack brick.
|
||||
|
||||
// 100 is KRAKEN!
|
||||
|
||||
// wolor array determines the color of standard bricks.
|
||||
// w is white.
|
||||
// r is red.
|
||||
@@ -733,25 +743,8 @@ void dd::Systems::LevelSystem::GetNextLevel()
|
||||
glm::vec4 p4 = glm::vec4(125.f / 255.f, 0.f / 255.f, 147.f / 255.f, 1.f);
|
||||
|
||||
|
||||
|
||||
|
||||
if (m_CurrentCluster == 0) {
|
||||
if (m_CurrentLevel == 1) {
|
||||
level =
|
||||
{0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0};
|
||||
color =
|
||||
{w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w};
|
||||
} else if (m_CurrentLevel == 2) {
|
||||
level =
|
||||
{1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
@@ -766,7 +759,7 @@ void dd::Systems::LevelSystem::GetNextLevel()
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w};
|
||||
} else if (m_CurrentLevel == 3) {
|
||||
} else if (m_CurrentLevel == 2) {
|
||||
level =
|
||||
{0, 0, 0, 0, 0, 0, 1,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
@@ -781,7 +774,7 @@ void dd::Systems::LevelSystem::GetNextLevel()
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w};
|
||||
} else if (m_CurrentLevel == 4) {
|
||||
} else if (m_CurrentLevel == 3) {
|
||||
level =
|
||||
{0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
@@ -796,7 +789,7 @@ void dd::Systems::LevelSystem::GetNextLevel()
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w};
|
||||
} else if (m_CurrentLevel == 5) {
|
||||
} else if (m_CurrentLevel == 4) {
|
||||
level =
|
||||
{0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
@@ -811,7 +804,37 @@ void dd::Systems::LevelSystem::GetNextLevel()
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w};
|
||||
}
|
||||
} else if (m_CurrentLevel == 5) {
|
||||
level =
|
||||
{0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 100, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0};
|
||||
color =
|
||||
{w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w};
|
||||
} else if (m_CurrentLevel == 6) {
|
||||
level =
|
||||
{0, 0, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0};
|
||||
color =
|
||||
{w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w};
|
||||
}
|
||||
} else if (m_CurrentCluster == 1) {
|
||||
if (m_CurrentLevel == 1) {
|
||||
level =
|
||||
@@ -888,7 +911,23 @@ void dd::Systems::LevelSystem::GetNextLevel()
|
||||
w, br, w, g, w, lb1, w,
|
||||
y, w, y, d, b, w, b,
|
||||
w, br, w, w, w, lb1, w};
|
||||
}
|
||||
}
|
||||
else if (m_CurrentLevel == 6) {
|
||||
level =
|
||||
{0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 100, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0};
|
||||
color =
|
||||
{w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w,
|
||||
w, w, w, w, w, w, w};
|
||||
}
|
||||
} else if (m_CurrentCluster == 3) {
|
||||
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ void dd::Systems::TravellingSystem::UpdateEntity(double dt, EntityID entity, Ent
|
||||
float yValue = position.y; // A negative value between -34.6 and -22.6;
|
||||
yValue += 22.6; // A positive value between -12 and 0. The distance it should travel from 34.6;
|
||||
background->distanceLeftToCorrectTravelPosition = yValue;
|
||||
std::cout << "This happened." << std::endl;
|
||||
} else {
|
||||
m_World->RemoveEntity(entity);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user