19 Commits

Author SHA1 Message Date
PlatinumSkink 22349fe0a6 Fixed problems I ran into while playtesting. 2015-10-23 17:42:46 +02:00
PlatinumSkink e4aae9779e Merge branch 'master' of https://github.com/teamfisk/AgileBreakOut 2015-10-23 16:59:24 +02:00
PlatinumSkink 5ba13c3b48 Merge remote-tracking branch 'origin/master' 2015-10-23 16:58:54 +02:00
PlatinumSkink 1beb873efc Fixed so ink does not damage boss, because that breaks current boss battle. 2015-10-23 16:46:45 +02:00
viktorljung 04ed2de2c3 saviours 2015-10-23 16:45:47 +02:00
tleety 825a4f5f95 Merge branch 'master' of github.com:teamfisk/AgileBreakOut 2015-10-23 16:16:26 +02:00
tleety ee413463a3 Kraken arm slider 2015-10-23 16:15:46 +02:00
viktorljung e2190630c5 Merge branch 'Physics' 2015-10-23 16:12:14 +02:00
Stiffly 4f75736747 Merge remote-tracking branch 'origin/master' into water 2015-10-23 15:55:32 +02:00
PlatinumSkink 857eaf4b7f Merge branch 'master' of https://github.com/teamfisk/AgileBreakOut 2015-10-23 15:52:43 +02:00
Stiffly 206b6ee36c Merge remote-tracking branch 'origin/master' into water 2015-10-23 15:49:41 +02:00
Stiffly 90f4d771ac Updated blood effects 2015-10-23 15:49:27 +02:00
Jace 92c9d52de5 Merge branch 'master' of github.com:teamfisk/AgileBreakOut 2015-10-23 15:47:52 +02:00
Jace 3c6c38b2ce Less slippery controls 2015-10-23 15:47:35 +02:00
PlatinumSkink a630554bb3 Merge branch 'LevelSystemAndSuch' 2015-10-23 15:47:08 +02:00
PlatinumSkink 2681ca8680 Lifebuoy created on brick transform after a small delay. 2015-10-23 15:46:26 +02:00
Stiffly 485cdb7b5e Blood in progress. <- period 2015-10-23 14:39:26 +02:00
Stiffly 525868e228 Merge remote-tracking branch 'origin/master' into water 2015-10-23 13:40:18 +02:00
Stiffly 2cf2975437 WIP 2015-10-23 13:39:59 +02:00
20 changed files with 219 additions and 98 deletions
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

+8 -2
View File
@@ -34,6 +34,7 @@
#include "CTemplate.h"
#include "Core/ConfigFile.h"
#include "Core/EventBroker.h"
#include "Input/InputSystem.h"
#include "Rendering/CModel.h"
#include "Rendering/CSprite.h"
#include "Rendering/CPointLight.h"
@@ -176,6 +177,9 @@ public:
m_World->ComponentFactory.Register<Components::InkBlasterBrick>();
m_World->ComponentFactory.Register<Components::KrakenAttackBrick>();
//m_World->SystemFactory.Register<Systems::InputSystem>(
// [this]() { return new Systems::InputSystem(m_World.get(), m_EventBroker); });
//m_World->AddSystem<Systems::InputSystem>();
m_World->SystemFactory.Register<Systems::LevelSystem>(
[this]() { return new Systems::LevelSystem(m_World.get(), m_EventBroker); });
m_World->AddSystem<Systems::LevelSystem>();
@@ -257,9 +261,10 @@ public:
m_LastTime = currentTime;
// Update input
m_EventBroker->Swap();
m_InputManager->Update(dt);
// Swap event queues to get fresh input data in the read queue
//m_EventBroker->Swap();
//m_EventBroker->Process<Systems::InputSystem>();
m_EventBroker->Swap();
//ResourceManager::Update();
if (m_GameIsRunning) {
@@ -284,6 +289,7 @@ public:
m_EventBroker->Process<Engine>();
// Swap event queues
m_EventBroker->Swap();
m_EventBroker->Clear();
glfwPollEvents();
}
+1
View File
@@ -121,6 +121,7 @@ public:
int Process();
int Process(std::string contextTypeName);
void Swap();
void Clear();
void Unsubscribe(BaseEventRelay &relay);
private:
+1 -1
View File
@@ -105,7 +105,7 @@ private:
std::mt19937 m_RandomGenerator;
float m_XMovementMultiplier = 2.f;
float m_EdgeX = 3.4f; //Actually 3.2, but anyways.
float m_EdgeX = 3.2f;
float m_EdgeY = 5.2f;
int m_MultiBalls = 0;
bool m_ReplaceBall = false;
+2
View File
@@ -6,6 +6,7 @@
#define DAYDREAM_EKRAKENHIT_H
#include "Core/EventBroker.h"
#include "Core/CTransform.h"
namespace dd
{
@@ -17,6 +18,7 @@ struct KrakenHit : Event
{
EntityID Kraken;
EntityID Hitter;
glm::vec3 PlaceHit;
int MaxHealth;
int CurrentHealth;
int NewHealth;
+4 -2
View File
@@ -41,8 +41,10 @@ public:
m_FPSCounter = new GUI::FPSCounter(this, "FPSCounter");
m_KrakenAttackSlider = new Slider(this, "KrakenSlider");
m_KrakenAttackSlider->SetTexture("Textures/GUI/Menu/SliderBackground.png");
m_KrakenAttackSlider->SetTextureReleased("Textures/GUI/Menu/SliderHandle.png");
m_KrakenAttackSlider->SetTexture("Textures/GUI/KrakenSlider/KrakenArmSliderBackground.png");
m_KrakenAttackSlider->SetTextureReleased("Textures/GUI/KrakenSlider/SpaceSpam.png");
m_KrakenAttackSlider->SetTexturePressed("Textures/GUI/KrakenSlider/SpaceHit.png");
m_KrakenAttackSlider->SetLeft(Width / 2 - m_KrakenAttackSlider->Width / 2);
m_KrakenAttackSlider->Y = 800;
m_KrakenAttackSlider->Hide();
+1
View File
@@ -103,6 +103,7 @@ private:
bool OnBrickGenerating(const dd::Events::BrickGenerating &event);
bool OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event);
void GetBrickSet();
void CreateBloodEffect(glm::vec3);
};
}
+5
View File
@@ -47,6 +47,10 @@ public:
private:
bool m_Pause = false;
EntityID m_Template;
Events::Lifebuoy m_SavedEvent;
bool m_Lifebuoy = false;
float m_Timer;
float m_WaitingTime = 0.4;
dd::EventRelay<LifebuoySystem, dd::Events::Contact> m_EContact;
dd::EventRelay<LifebuoySystem, dd::Events::Pause> m_EPause;
@@ -58,6 +62,7 @@ private:
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnLifebuoy(const dd::Events::Lifebuoy &event);
bool Lifebuoy(const dd::Events::Lifebuoy &event);
bool OnLifebuoyHit(const dd::Events::LifebuoyHit &event);
struct LifebuoyInfo
+2
View File
@@ -26,6 +26,8 @@ struct ParticleEmitter : public Component
//values to interpolate between.
std::vector<glm::vec3> ScaleValues;
std::vector<float> AlphaValues;
std::vector<glm::vec3> VelocityValues;
//System variables
float GravityScale = 1.0f;
@@ -29,6 +29,7 @@ struct CreateParticleSequence : public Event
bool DefaultScale = false;
std::vector<glm::vec3> ScaleValues;
std::vector<float> AlphaValues;
std::vector<glm::vec3> VelocityValues;
//Particle
std::string SpriteFile = "";
+4 -1
View File
@@ -91,8 +91,11 @@ int dd::EventBroker::Process(std::string contextTypeName)
void dd::EventBroker::Swap()
{
std::swap(m_EventQueueRead, m_EventQueueWrite);
m_EventQueueWrite->clear();
}
void dd::EventBroker::Clear()
{
m_EventQueueWrite->clear();
}
void dd::EventBroker::subscribeImmediate(dd::BaseEventRelay& relay)
+6 -6
View File
@@ -471,17 +471,17 @@ bool dd::Systems::BallSystem::OnMultiBall(const dd::Events::MultiBall &event)
ball2->Waiting = false;
auto padTransform = event.padTransform;
float x1 = padTransform->Position.x/* - 2*/, x2 = padTransform->Position.x/* + 2*/;
if (x1 < -m_EdgeX) {
x1 = m_EdgeX - 0.2;
if (x1 < -m_EdgeX + 0.4) {
x1 = m_EdgeX - 0.7;
}
if (x2 > m_EdgeX) {
x2 = -m_EdgeX + 0.2;
if (x2 > m_EdgeX - 0.4) {
x2 = -m_EdgeX + 0.7;
}
transform1->Position = glm::vec3(x1, -5.5, -10);
transform2->Position = glm::vec3(x2, -5.5, -10);
transform1->Velocity = glm::normalize(glm::vec3(5, 5 ,0.f)) * ball1->Speed;
transform2->Velocity = glm::normalize(glm::vec3(-5, 5 ,0.f)) * ball2->Speed;
transform1->Velocity = glm::normalize(glm::vec3(2.5, 5 ,0.f)) * ball1->Speed;
transform2->Velocity = glm::normalize(glm::vec3(-2.5, 5 ,0.f)) * ball2->Speed;
SetMultiBalls(MultiBalls() + 2);
//std::cout << MultiBalls() << std::endl;
+83 -52
View File
@@ -247,16 +247,20 @@ bool dd::Systems::KrakenSystem::OnContact(const dd::Events::Contact &event)
auto projectile = m_World->GetComponent<Components::Projectile>(otherEntitiy);
if (projectile != nullptr) {
Events::ScoreEvent es;
es.Score = 23;
EventBroker->Publish(es);
Events::KrakenHit e;
e.Kraken = krakenEntity;
e.Hitter = otherEntitiy;
e.MaxHealth = kraken->MaxHealth;
e.CurrentHealth = kraken->Health;
e.NewHealth = kraken->Health - 1;
EventBroker->Publish(e);
if (m_RandomKraken) {
Events::ScoreEvent es;
es.Score = 23;
EventBroker->Publish(es);
Events::KrakenHit e;
e.Kraken = krakenEntity;
e.Hitter = otherEntitiy;
auto transform = m_World->GetComponent<Components::Transform>(otherEntitiy);
e.PlaceHit = transform->Position;
e.MaxHealth = kraken->MaxHealth;
e.CurrentHealth = kraken->Health;
e.NewHealth = kraken->Health - 1;
EventBroker->Publish(e);
}
m_World->RemoveEntity(otherEntitiy);
return true;
}
@@ -273,6 +277,8 @@ bool dd::Systems::KrakenSystem::OnContact(const dd::Events::Contact &event)
Events::KrakenHit e;
e.Kraken = krakenEntity;
e.Hitter = otherEntitiy;
auto transform = m_World->GetComponent<Components::Transform>(otherEntitiy);
e.PlaceHit = transform->Position;
e.MaxHealth = kraken->MaxHealth;
e.CurrentHealth = kraken->Health;
e.NewHealth = kraken->Health - 1;
@@ -317,7 +323,6 @@ bool dd::Systems::KrakenSystem::OnKrakenAttack(const dd::Events::KrakenAttack &e
bool dd::Systems::KrakenSystem::OnKrakenHit(const dd::Events::KrakenHit &event)
{
auto kraken = m_World->GetComponent<Components::Kraken>(event.Kraken);
auto transform = m_World->GetComponent<Components::Transform>(event.Hitter);
kraken->Health--;
kraken->CurrentAction = 3;
//kraken->Health -= 15;
@@ -332,47 +337,7 @@ bool dd::Systems::KrakenSystem::OnKrakenHit(const dd::Events::KrakenHit &event)
m_KrakenCurrentSecondsToAction = m_KrakenMaxSecondsToAction - (modifier * timeDifferenceBetweenMaxAndMin);
// If modifier is 1, MaxSeconds is 15, MinSeconds is 5, then... 15 - (1 * 10), meaning 5.
auto ball = m_World->GetComponent<Components::Transform>(event.Hitter);
if (ball != nullptr) {
//Particle trail
Events::CreateParticleSequence trail;
trail.parent = event.Hitter;
trail.AlphaValues.push_back(1.f);
trail.AlphaValues.push_back(0.f);
trail.ScaleValues.push_back(glm::vec3(0.08f));
trail.ScaleValues.push_back(glm::vec3(0.f));
trail.RadiusDistribution = 2;
trail.EmitterLifeTime = 1.f;
trail.ParticleLifeTime = 1.f;
trail.ParticlesPerTick = 1;
trail.SpawnRate = 0.5f;
trail.Speed = 10.f;
trail.EmittingAngle = glm::half_pi<float>();
trail.SpriteFile = "Textures/Particles/FadeBall.png";
trail.Color = glm::vec4(1, 0, 0, 1);
//p.Spread = ...
EventBroker->Publish(trail);
}
//ParticlePoof
Events::CreateParticleSequence poof;
poof.EmitterLifeTime = 4;
poof.EmittingAngle = glm::half_pi<float>();
poof.Spread = 0.5f;
poof.NumberOfTicks = 1;
poof.ParticleLifeTime = 1.5f;
poof.ParticlesPerTick = 2;
poof.Position = transform->Position;
poof.ScaleValues.clear();
poof.ScaleValues.push_back(glm::vec3(0.5f));
poof.ScaleValues.push_back(glm::vec3(2.f, 2.f, 0.2f));
poof.SpriteFile = "Textures/Particles/Cloud_Particle.png";
poof.Color = glm::vec4(1, 0, 0, 1);
poof.AlphaValues.clear();
poof.AlphaValues.push_back(1.f);
poof.AlphaValues.push_back(0.f);
poof.Speed = 20;
EventBroker->Publish(poof);
CreateBloodEffect(event.PlaceHit);
//std::cout << kraken->Health << std::endl;
//kraken->Health = -1;
@@ -489,4 +454,70 @@ bool dd::Systems::KrakenSystem::OnArrivedAtNewStage(const dd::Events::ArrivedAtN
m_KrakenHasArrived = true;
}
return true;
}
void dd::Systems::KrakenSystem::CreateBloodEffect(glm::vec3 pos)
{
//ParticlePoof
Events::CreateParticleSequence dust;
dust.EmitterLifeTime = 4;
dust.EmittingAngle = glm::half_pi<float>();
dust.Spread = 0.5f;
dust.NumberOfTicks = 1;
dust.ParticleLifeTime = 1.f;
dust.ParticlesPerTick = 1;
dust.Position = pos;
dust.ScaleValues.clear();
dust.ScaleValues.push_back(glm::vec3(0.5f));
dust.ScaleValues.push_back(glm::vec3(2.f, 2.f, 0.2f));
dust.SpriteFile = "Textures/Particles/Cloud_Particle.png";
dust.Color = glm::vec4(1, 0, 0, 1);
dust.AlphaValues.clear();
dust.AlphaValues.push_back(1.f);
dust.AlphaValues.push_back(0.f);
dust.Speed = 20;
EventBroker->Publish(dust);
std::uniform_real_distribution<float> dist(glm::pi<float>(), glm::two_pi<float>());
for (int i = 0; i < 3; i++) {
float angle = dist(m_RandomGenerator);
Events::CreateParticleSequence squirt;
squirt.EmitterLifeTime = 0.3f;
squirt.EmittingAngle = angle;
squirt.Spread = 0;
squirt.SpawnRate = 0.01f;
squirt.ParticleLifeTime = 0.5f;
squirt.ParticlesPerTick = 1;
squirt.Position = pos;
squirt.ScaleValues.clear();
squirt.ScaleValues.push_back(glm::vec3(0.09f));
squirt.SpriteFile = "Textures/Particles/FadeBall.png";
squirt.Color = glm::vec4(1, 0, 0, 1);
squirt.AlphaValues.clear();
squirt.AlphaValues.push_back(1.f);
squirt.AlphaValues.push_back(0.f);
squirt.Speed = 1000;
EventBroker->Publish(squirt);
}
Events::CreateParticleSequence drop;
drop.EmitterLifeTime = 7.f;
drop.SpawnRate = 0.1f;
//drop.EmittingAngle = glm::two_pi<float>() + glm::pi<float>();
drop.EmittingAngle = -glm::half_pi<float>();
drop.Spread = 0;
//drop.Spread = glm::two_pi<float>();
drop.ParticleLifeTime = 1.f;
drop.ParticlesPerTick = 2;
drop.Position = pos;
drop.ScaleValues.clear();
drop.ScaleValues.push_back(glm::vec3(.15f));
drop.ScaleValues.push_back(glm::vec3(0.1f));
drop.SpriteFile = "Textures/Particles/FadeBall.png";
drop.Color = glm::vec4(1, 0, 0, 1);
drop.AlphaValues.clear();
drop.AlphaValues.push_back(1.f);
drop.AlphaValues.push_back(0.f);
drop.GravityScale = 0;
drop.Speed = 300;
EventBroker->Publish(drop);
}
+12 -7
View File
@@ -733,7 +733,7 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
0, 0, 0, 0, 0, 0, 0,
6, 0, 1, 0, 1, 0, 6,
0, 1, 1, 1, 1, 1, 0,
0, 0, 4, 1, 1, 0, 0,
0, 0, 5, 1, 1, 0, 0,
0, 0, 0, 1, 0, 0, 0 };
color =
{b, b, b, b, b, b, b,
@@ -792,7 +792,7 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
if (set == 1) {
level = // The Butterfly
{4, 0, 0, 1, 0, 0, 1,
1, 6, 0, 1, 0, 6, 1,
1, 6, 0, 1, 0, 1, 1,
1, 1, 1, 6, 1, 1, 1,
1, 1, 0, 1, 0, 1, 1,
1, 0, 0, 1, 0, 0, 1,
@@ -841,7 +841,7 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
0, 0, 0, 0, 0, 0, 0,
1, 6, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0,
1, 3, 1, 1, 1, 1, 5 };
1, 3, 1, 1, 1, 1, 1 };
color =
{m, m, m, m, m, m, m,
m, m, m, m, m, m, m,
@@ -856,7 +856,7 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
0, 0, 1, 1, 1, 0, 0,
1, 1, 1, 0, 1, 1, 1,
3, 6, 1, 0, 1, 6, 1,
1, 1, 1, 0, 1, 1, 1 };
1, 1, 1, 0, 1, 1, 5 };
color =
{g, g, g, g, g, g, g,
g, g, g, g, g, g, g,
@@ -1023,8 +1023,13 @@ void dd::Systems::LevelSystem::BrickHit(EntityID entityHitter, EntityID entityBr
if (kraken != nullptr) {
Events::KrakenAttack e;
e.ChargeUpdate = 0;
e.KrakenStrength = 0.1;
e.PlayerStrength = 0.05;
if (m_KrakenBattle) {
e.KrakenStrength = 0.1;
e.PlayerStrength = 0.12;
} else {
e.KrakenStrength = 0.1;
e.PlayerStrength = 0.05;
}
EventBroker->Publish(e);
}
else {
@@ -1268,7 +1273,7 @@ void dd::Systems::LevelSystem::GetNextLevel()
level =
{0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
2, 2, 2, 2, 2, 2, 2,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1};
+84 -24
View File
@@ -44,11 +44,16 @@ void dd::Systems::LifebuoySystem::Initialize()
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();) { //Niklas note: Jag fortstatte få fel efter ni gick hem, och jag förstod inte det här så jag gjorde om som jag visste hur i UpdateEntity.
auto transformComponent = m_World->GetComponent<Components::Transform>(it->Entity);
auto lifebuoyComponent = m_World->GetComponent<Components::Lifebuoy>(it->Entity);
if (!m_World->ValidEntity(it->Entity)){
m_Lifebuoys.erase(it++);
}
if (transformComponent->Position.y < m_DownEdge) {
m_World->RemoveEntity(it->Entity);
m_Lifebuoys.erase(it++);
@@ -75,6 +80,19 @@ void dd::Systems::LifebuoySystem::Update(double dt)
++it;
}
}*/
if (IsPaused()) {
return;
}
if (m_Lifebuoy) {
m_Timer += dt;
if (m_Timer > m_WaitingTime) {
m_Timer = 0;
m_Lifebuoy = false;
Lifebuoy(m_SavedEvent);
}
}
}
@@ -85,6 +103,38 @@ void dd::Systems::LifebuoySystem::UpdateEntity(double dt, EntityID entity, Entit
}
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
if (templateCheck != nullptr){ return; }
auto lifebuoyComponent = m_World->GetComponent<Components::Lifebuoy>(entity);
if (lifebuoyComponent != nullptr) {
auto transformComponent = m_World->GetComponent<Components::Transform>(entity);
if (transformComponent->Position.y < m_DownEdge) {
m_World->RemoveEntity(entity);
//m_Lifebuoys.erase(it++);
}
else {
if (transformComponent->Position.x > m_RightEdge) {
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);
}
if (lifebuoyComponent->Hits <= 0) {
auto physicsComponent = m_World->GetComponent<Components::Physics>(entity);
physicsComponent->Mask = CollisionLayer::Type::LifeBuoy;
physicsComponent->GravityScale = 10.f;
auto modelComponent = m_World->GetComponent<Components::Model>(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;
}
}
}
}
bool dd::Systems::LifebuoySystem::OnPause(const dd::Events::Pause &event)
@@ -113,7 +163,14 @@ bool dd::Systems::LifebuoySystem::OnContact(const dd::Events::Contact &event)
return true;
}
bool dd::Systems::LifebuoySystem::OnLifebuoy(const dd::Events::Lifebuoy &event)
bool dd::Systems::LifebuoySystem::OnLifebuoy(const dd::Events::Lifebuoy &event)
{
m_Lifebuoy = true;
m_SavedEvent = event;
return true;
}
bool dd::Systems::LifebuoySystem::Lifebuoy(const dd::Events::Lifebuoy &event)
{
auto ent = m_World->CloneEntity(m_Template);
m_World->SetProperty(ent, "Name", "Lifebuoy");
@@ -121,7 +178,8 @@ bool dd::Systems::LifebuoySystem::OnLifebuoy(const dd::Events::Lifebuoy &event)
auto transform = m_World->GetComponent<Components::Transform>(ent);
auto physics = m_World->GetComponent<Components::Physics>(ent);
physics->CollisionType = CollisionType::Type::Dynamic;
transform->Position = glm::vec3(0.f, 0.f, -10.f);
//transform->Position = glm::vec3(0.f, 0.f, -10.f);
transform->Position = event.Transform->Position;
transform->Velocity = glm::vec3(20.f, 3.f, 0.f);
LifebuoyInfo info;
info.Entity = ent;
@@ -134,28 +192,30 @@ bool dd::Systems::LifebuoySystem::OnLifebuoyHit(const dd::Events::LifebuoyHit &e
{
auto transformComponent = m_World->GetComponent<Components::Transform>(event.Lifebuoy);
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";
if (lifebuoyComponent != nullptr) {
lifebuoyComponent->Hits -= 1;
auto modelComponent = m_World->GetComponent<Components::Model>(event.Lifebuoy);
modelComponent->ModelFile = "Models/Lifebuoy/Lifebuoy" + std::to_string(5 - lifebuoyComponent->Hits) + ".obj";
Events::CreateParticleSequence e;
e.EmitterLifeTime = 4;
e.EmittingAngle = glm::half_pi<float>();
e.Spread = 0.5f;
e.NumberOfTicks = 1;
e.ParticleLifeTime = 2.f;
e.ParticlesPerTick = 1;
e.Position = transformComponent->Position;
e.ScaleValues.clear();
e.ScaleValues.push_back(glm::vec3(0.5f));
e.ScaleValues.push_back(glm::vec3(2.f, 2.f, 0.2f));
e.SpriteFile = "Textures/Particles/Cloud_Particle.png";
e.Color = glm::vec4(1, 0, 0, 1);
e.AlphaValues.clear();
e.AlphaValues.push_back(1.f);
e.AlphaValues.push_back(0.f);
e.Speed = 10.f;
EventBroker->Publish(e);
Events::CreateParticleSequence e;
e.EmitterLifeTime = 4;
e.EmittingAngle = glm::half_pi<float>();
e.Spread = 0.5f;
e.NumberOfTicks = 1;
e.ParticleLifeTime = 2.f;
e.ParticlesPerTick = 1;
e.Position = transformComponent->Position;
e.ScaleValues.clear();
e.ScaleValues.push_back(glm::vec3(0.5f));
e.ScaleValues.push_back(glm::vec3(2.f, 2.f, 0.2f));
e.SpriteFile = "Textures/Particles/Cloud_Particle.png";
e.Color = glm::vec4(1, 0, 0, 1);
e.AlphaValues.clear();
e.AlphaValues.push_back(1.f);
e.AlphaValues.push_back(0.f);
e.Speed = 10.f;
EventBroker->Publish(e);
}
return true;
}
+1
View File
@@ -56,6 +56,7 @@ void dd::Systems::PadSystem::Initialize()
cModel->ModelFile = "Models/Ship/Ship.obj";
auto pad = m_World->AddComponent<Components::Pad>(ent);
pad->SlowdownModifier = 10.f;
m_World->CommitEntity(ent);
m_Edge = 3.2 - (ctransform->Scale.x / 2);
+4 -3
View File
@@ -222,10 +222,10 @@ void dd::Systems::PhysicsSystem::Update(double dt)
for (auto i : m_EntitiesToParticleHandle[e]){
EntityID entity = i.first;
const b2ParticleHandle *particleH = i.second;
b2Vec2 positionB2 = positionBuffer[particleH->GetIndex()];
glm::vec2 position = glm::vec2(positionB2.x, positionB2.y);
EntityID entityParent = m_World->GetEntityParent(entity);
glm::vec3 parentTransform = glm::vec3(0.f);
if(entityParent) {
@@ -592,7 +592,7 @@ void dd::Systems::PhysicsSystem::UpdateParticleEmitters(double dt)
//Random z-value
std::uniform_real_distribution<float> dist(0, 1);
std::uniform_real_distribution<float> dist(0, 0.1);
float zDistribution = dist(gen);
particleTransform->Position = glm::vec3(emitterTransform->Position.x, emitterTransform->Position.y, -9.5f + zDistribution);
particleTransform->Scale = particleTemplate->Scale;
@@ -730,6 +730,7 @@ bool dd::Systems::PhysicsSystem::CreateParticleSequence(const Events::CreatePart
particleEmitter->RadiusDistribution = event.RadiusDistribution;
particleEmitter->DefaultScale = event.DefaultScale;
particleEmitter->ScaleValues = event.ScaleValues;
particleEmitter->VelocityValues = event.VelocityValues;
{
//Creating Particle Template
auto particle = m_World->CreateEntity(emitter);