Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 965cebf708 | |||
| 4f75736747 | |||
| 857eaf4b7f | |||
| 206b6ee36c | |||
| 90f4d771ac | |||
| 92c9d52de5 | |||
| 3c6c38b2ce | |||
| a630554bb3 | |||
| 2681ca8680 | |||
| 485cdb7b5e | |||
| 525868e228 | |||
| 2cf2975437 |
Binary file not shown.
@@ -34,6 +34,7 @@
|
|||||||
#include "CTemplate.h"
|
#include "CTemplate.h"
|
||||||
#include "Core/ConfigFile.h"
|
#include "Core/ConfigFile.h"
|
||||||
#include "Core/EventBroker.h"
|
#include "Core/EventBroker.h"
|
||||||
|
#include "Input/InputSystem.h"
|
||||||
#include "Rendering/CModel.h"
|
#include "Rendering/CModel.h"
|
||||||
#include "Rendering/CSprite.h"
|
#include "Rendering/CSprite.h"
|
||||||
#include "Rendering/CPointLight.h"
|
#include "Rendering/CPointLight.h"
|
||||||
@@ -176,6 +177,9 @@ public:
|
|||||||
m_World->ComponentFactory.Register<Components::InkBlasterBrick>();
|
m_World->ComponentFactory.Register<Components::InkBlasterBrick>();
|
||||||
m_World->ComponentFactory.Register<Components::KrakenAttackBrick>();
|
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>(
|
m_World->SystemFactory.Register<Systems::LevelSystem>(
|
||||||
[this]() { return new Systems::LevelSystem(m_World.get(), m_EventBroker); });
|
[this]() { return new Systems::LevelSystem(m_World.get(), m_EventBroker); });
|
||||||
m_World->AddSystem<Systems::LevelSystem>();
|
m_World->AddSystem<Systems::LevelSystem>();
|
||||||
@@ -257,9 +261,10 @@ public:
|
|||||||
m_LastTime = currentTime;
|
m_LastTime = currentTime;
|
||||||
|
|
||||||
// Update input
|
// Update input
|
||||||
|
m_EventBroker->Swap();
|
||||||
m_InputManager->Update(dt);
|
m_InputManager->Update(dt);
|
||||||
// Swap event queues to get fresh input data in the read queue
|
//m_EventBroker->Process<Systems::InputSystem>();
|
||||||
//m_EventBroker->Swap();
|
m_EventBroker->Swap();
|
||||||
|
|
||||||
//ResourceManager::Update();
|
//ResourceManager::Update();
|
||||||
if (m_GameIsRunning) {
|
if (m_GameIsRunning) {
|
||||||
@@ -284,6 +289,7 @@ public:
|
|||||||
m_EventBroker->Process<Engine>();
|
m_EventBroker->Process<Engine>();
|
||||||
// Swap event queues
|
// Swap event queues
|
||||||
m_EventBroker->Swap();
|
m_EventBroker->Swap();
|
||||||
|
m_EventBroker->Clear();
|
||||||
|
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ public:
|
|||||||
int Process();
|
int Process();
|
||||||
int Process(std::string contextTypeName);
|
int Process(std::string contextTypeName);
|
||||||
void Swap();
|
void Swap();
|
||||||
|
void Clear();
|
||||||
void Unsubscribe(BaseEventRelay &relay);
|
void Unsubscribe(BaseEventRelay &relay);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ private:
|
|||||||
bool OnBrickGenerating(const dd::Events::BrickGenerating &event);
|
bool OnBrickGenerating(const dd::Events::BrickGenerating &event);
|
||||||
bool OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event);
|
bool OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event);
|
||||||
void GetBrickSet();
|
void GetBrickSet();
|
||||||
|
void CreateBloodEffect(glm::vec3);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool m_Pause = false;
|
bool m_Pause = false;
|
||||||
EntityID m_Template;
|
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::Contact> m_EContact;
|
||||||
dd::EventRelay<LifebuoySystem, dd::Events::Pause> m_EPause;
|
dd::EventRelay<LifebuoySystem, dd::Events::Pause> m_EPause;
|
||||||
@@ -58,6 +62,7 @@ private:
|
|||||||
bool OnPause(const dd::Events::Pause &event);
|
bool OnPause(const dd::Events::Pause &event);
|
||||||
bool OnResume(const dd::Events::Resume &event);
|
bool OnResume(const dd::Events::Resume &event);
|
||||||
bool OnLifebuoy(const dd::Events::Lifebuoy &event);
|
bool OnLifebuoy(const dd::Events::Lifebuoy &event);
|
||||||
|
bool Lifebuoy(const dd::Events::Lifebuoy &event);
|
||||||
bool OnLifebuoyHit(const dd::Events::LifebuoyHit &event);
|
bool OnLifebuoyHit(const dd::Events::LifebuoyHit &event);
|
||||||
|
|
||||||
struct LifebuoyInfo
|
struct LifebuoyInfo
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "Physics/CPhysics.h"
|
#include "Physics/CPhysics.h"
|
||||||
#include "Physics/CCircleShape.h"
|
#include "Physics/CCircleShape.h"
|
||||||
#include "Physics/ESetImpulse.h"
|
#include "Physics/ESetImpulse.h"
|
||||||
|
#include "Physics/ECreateParticleSequence.h"
|
||||||
|
|
||||||
#include "Rendering/CSprite.h"
|
#include "Rendering/CSprite.h"
|
||||||
#include "Rendering/CModel.h"
|
#include "Rendering/CModel.h"
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ struct ParticleEmitter : public Component
|
|||||||
//values to interpolate between.
|
//values to interpolate between.
|
||||||
std::vector<glm::vec3> ScaleValues;
|
std::vector<glm::vec3> ScaleValues;
|
||||||
std::vector<float> AlphaValues;
|
std::vector<float> AlphaValues;
|
||||||
|
std::vector<glm::vec3> VelocityValues;
|
||||||
|
|
||||||
|
|
||||||
//System variables
|
//System variables
|
||||||
float GravityScale = 1.0f;
|
float GravityScale = 1.0f;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ struct CreateParticleSequence : public Event
|
|||||||
bool DefaultScale = false;
|
bool DefaultScale = false;
|
||||||
std::vector<glm::vec3> ScaleValues;
|
std::vector<glm::vec3> ScaleValues;
|
||||||
std::vector<float> AlphaValues;
|
std::vector<float> AlphaValues;
|
||||||
|
std::vector<glm::vec3> VelocityValues;
|
||||||
|
|
||||||
//Particle
|
//Particle
|
||||||
std::string SpriteFile = "";
|
std::string SpriteFile = "";
|
||||||
|
|||||||
@@ -91,8 +91,11 @@ int dd::EventBroker::Process(std::string contextTypeName)
|
|||||||
void dd::EventBroker::Swap()
|
void dd::EventBroker::Swap()
|
||||||
{
|
{
|
||||||
std::swap(m_EventQueueRead, m_EventQueueWrite);
|
std::swap(m_EventQueueRead, m_EventQueueWrite);
|
||||||
m_EventQueueWrite->clear();
|
}
|
||||||
|
|
||||||
|
void dd::EventBroker::Clear()
|
||||||
|
{
|
||||||
|
m_EventQueueWrite->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void dd::EventBroker::subscribeImmediate(dd::BaseEventRelay& relay)
|
void dd::EventBroker::subscribeImmediate(dd::BaseEventRelay& relay)
|
||||||
|
|||||||
@@ -332,47 +332,7 @@ bool dd::Systems::KrakenSystem::OnKrakenHit(const dd::Events::KrakenHit &event)
|
|||||||
m_KrakenCurrentSecondsToAction = m_KrakenMaxSecondsToAction - (modifier * timeDifferenceBetweenMaxAndMin);
|
m_KrakenCurrentSecondsToAction = m_KrakenMaxSecondsToAction - (modifier * timeDifferenceBetweenMaxAndMin);
|
||||||
// If modifier is 1, MaxSeconds is 15, MinSeconds is 5, then... 15 - (1 * 10), meaning 5.
|
// 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);
|
CreateBloodEffect(transform->Position);
|
||||||
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);
|
|
||||||
|
|
||||||
//std::cout << kraken->Health << std::endl;
|
//std::cout << kraken->Health << std::endl;
|
||||||
//kraken->Health = -1;
|
//kraken->Health = -1;
|
||||||
@@ -489,4 +449,70 @@ bool dd::Systems::KrakenSystem::OnArrivedAtNewStage(const dd::Events::ArrivedAtN
|
|||||||
m_KrakenHasArrived = true;
|
m_KrakenHasArrived = true;
|
||||||
}
|
}
|
||||||
return 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);
|
||||||
}
|
}
|
||||||
@@ -792,7 +792,7 @@ void dd::Systems::LevelSystem::GetBrickSet(int set, int setCluster) // These are
|
|||||||
if (set == 1) {
|
if (set == 1) {
|
||||||
level = // The Butterfly
|
level = // The Butterfly
|
||||||
{4, 0, 0, 1, 0, 0, 1,
|
{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, 1, 6, 1, 1, 1,
|
||||||
1, 1, 0, 1, 0, 1, 1,
|
1, 1, 0, 1, 0, 1, 1,
|
||||||
1, 0, 0, 1, 0, 0, 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,
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
1, 6, 1, 1, 1, 1, 1,
|
1, 6, 1, 1, 1, 1, 1,
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
1, 3, 1, 1, 1, 1, 5 };
|
1, 3, 1, 1, 1, 1, 1 };
|
||||||
color =
|
color =
|
||||||
{m, m, m, m, m, m, m,
|
{m, m, m, m, m, m, m,
|
||||||
m, m, m, m, m, m, m,
|
m, m, m, m, m, m, m,
|
||||||
|
|||||||
@@ -76,6 +76,19 @@ void dd::Systems::LifebuoySystem::Update(double dt)
|
|||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsPaused()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Lifebuoy) {
|
||||||
|
m_Timer += dt;
|
||||||
|
if (m_Timer > m_WaitingTime) {
|
||||||
|
m_Timer = 0;
|
||||||
|
m_Lifebuoy = false;
|
||||||
|
Lifebuoy(m_SavedEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dd::Systems::LifebuoySystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
void dd::Systems::LifebuoySystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||||
@@ -113,7 +126,14 @@ bool dd::Systems::LifebuoySystem::OnContact(const dd::Events::Contact &event)
|
|||||||
return true;
|
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);
|
auto ent = m_World->CloneEntity(m_Template);
|
||||||
m_World->SetProperty(ent, "Name", "Lifebuoy");
|
m_World->SetProperty(ent, "Name", "Lifebuoy");
|
||||||
@@ -121,7 +141,8 @@ bool dd::Systems::LifebuoySystem::OnLifebuoy(const dd::Events::Lifebuoy &event)
|
|||||||
auto transform = m_World->GetComponent<Components::Transform>(ent);
|
auto transform = m_World->GetComponent<Components::Transform>(ent);
|
||||||
auto physics = m_World->GetComponent<Components::Physics>(ent);
|
auto physics = m_World->GetComponent<Components::Physics>(ent);
|
||||||
physics->CollisionType = CollisionType::Type::Dynamic;
|
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);
|
transform->Velocity = glm::vec3(20.f, 3.f, 0.f);
|
||||||
LifebuoyInfo info;
|
LifebuoyInfo info;
|
||||||
info.Entity = ent;
|
info.Entity = ent;
|
||||||
|
|||||||
+36
-19
@@ -38,32 +38,49 @@ void dd::Systems::PadSystem::Initialize()
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EStickyPad, &PadSystem::OnStickyPad);
|
EVENT_SUBSCRIBE_MEMBER(m_EStickyPad, &PadSystem::OnStickyPad);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EStickyAttachedToPad, &PadSystem::OnStickyAttachedToPad);
|
EVENT_SUBSCRIBE_MEMBER(m_EStickyAttachedToPad, &PadSystem::OnStickyAttachedToPad);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &PadSystem::OnActionButton);
|
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &PadSystem::OnActionButton);
|
||||||
//EVENT_SUBSCRIBE_MEMBER(m_EBindKey, &PadSystem::OnBindKey);
|
//EVENT_SUBSCRIBE_MEMBER(m_EBindKey, &PadSystem::OnBindKey);
|
||||||
|
|
||||||
{
|
{
|
||||||
auto ent = m_World->CreateEntity();
|
auto ent = m_World->CreateEntity();
|
||||||
m_World->SetProperty(ent, "Name", "Pad");
|
m_World->SetProperty(ent, "Name", "Pad");
|
||||||
auto ctransform = m_World->AddComponent<Components::Transform>(ent);
|
auto ctransform = m_World->AddComponent<Components::Transform>(ent);
|
||||||
ctransform->Position = glm::vec3(0.f, m_PadHeight, -10.f);
|
ctransform->Position = glm::vec3(0.f, m_PadHeight, -10.f);
|
||||||
auto rectangleShape = m_World->AddComponent<Components::RectangleShape>(ent);
|
auto rectangleShape = m_World->AddComponent<Components::RectangleShape>(ent);
|
||||||
rectangleShape->Dimensions = glm::vec2(1.f, 0.1f);
|
rectangleShape->Dimensions = glm::vec2(1.f, 0.1f);
|
||||||
auto physics = m_World->AddComponent<Components::Physics>(ent);
|
auto physics = m_World->AddComponent<Components::Physics>(ent);
|
||||||
physics->CollisionType = CollisionType::Type::Kinematic;
|
physics->CollisionType = CollisionType::Type::Kinematic;
|
||||||
physics->Category = CollisionLayer::Type::Pad;
|
physics->Category = CollisionLayer::Type::Pad;
|
||||||
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::PowerUp | CollisionLayer::LifeBuoy);
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::PowerUp | CollisionLayer::LifeBuoy);
|
||||||
physics->Calculate = true;
|
physics->Calculate = true;
|
||||||
auto cModel = m_World->AddComponent<Components::Model>(ent);
|
auto cModel = m_World->AddComponent<Components::Model>(ent);
|
||||||
cModel->ModelFile = "Models/Ship/Ship.obj";
|
cModel->ModelFile = "Models/Ship/Ship.obj";
|
||||||
|
|
||||||
auto pad = m_World->AddComponent<Components::Pad>(ent);
|
auto pad = m_World->AddComponent<Components::Pad>(ent);
|
||||||
m_World->CommitEntity(ent);
|
pad->SlowdownModifier = 10.f;
|
||||||
|
m_World->CommitEntity(ent);
|
||||||
|
|
||||||
|
m_Edge = 3.2 - (ctransform->Scale.x / 2);
|
||||||
|
|
||||||
m_Edge = 3.2 - (ctransform->Scale.x / 2);
|
|
||||||
|
|
||||||
m_PadEntity = ent;
|
m_PadEntity = ent;
|
||||||
m_PadTransform = ctransform.get();
|
m_PadTransform = ctransform.get();
|
||||||
m_PadComponent = pad.get();
|
m_PadComponent = pad.get();
|
||||||
}
|
|
||||||
|
Events::CreateParticleSequence e;
|
||||||
|
e.SpriteFile = "Textures/Particles/FadeBall.png";
|
||||||
|
e.Color = glm::vec4(0, 0, 1, 1);
|
||||||
|
e.EmitterLifeTime = 9999999999;
|
||||||
|
e.EmittingAngle = glm::two_pi<float>();
|
||||||
|
e.ParticleLifeTime = 0.5f;
|
||||||
|
e.ParticlesPerTick = 2;
|
||||||
|
e.ScaleValues.push_back(glm::vec3(2));
|
||||||
|
e.AlphaValues.push_back(1.f);
|
||||||
|
e.SpawnRate = 0.1;
|
||||||
|
e.Spread = glm::half_pi<float>();
|
||||||
|
e.Speed = 10;
|
||||||
|
e.parent = m_PadEntity;
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//Stick
|
//Stick
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -222,10 +222,10 @@ void dd::Systems::PhysicsSystem::Update(double dt)
|
|||||||
for (auto i : m_EntitiesToParticleHandle[e]){
|
for (auto i : m_EntitiesToParticleHandle[e]){
|
||||||
EntityID entity = i.first;
|
EntityID entity = i.first;
|
||||||
const b2ParticleHandle *particleH = i.second;
|
const b2ParticleHandle *particleH = i.second;
|
||||||
|
|
||||||
b2Vec2 positionB2 = positionBuffer[particleH->GetIndex()];
|
b2Vec2 positionB2 = positionBuffer[particleH->GetIndex()];
|
||||||
glm::vec2 position = glm::vec2(positionB2.x, positionB2.y);
|
glm::vec2 position = glm::vec2(positionB2.x, positionB2.y);
|
||||||
|
|
||||||
EntityID entityParent = m_World->GetEntityParent(entity);
|
EntityID entityParent = m_World->GetEntityParent(entity);
|
||||||
glm::vec3 parentTransform = glm::vec3(0.f);
|
glm::vec3 parentTransform = glm::vec3(0.f);
|
||||||
if(entityParent) {
|
if(entityParent) {
|
||||||
@@ -592,7 +592,7 @@ void dd::Systems::PhysicsSystem::UpdateParticleEmitters(double dt)
|
|||||||
|
|
||||||
|
|
||||||
//Random z-value
|
//Random z-value
|
||||||
std::uniform_real_distribution<float> dist(0, 1);
|
std::uniform_real_distribution<float> dist(0, 0.1);
|
||||||
float zDistribution = dist(gen);
|
float zDistribution = dist(gen);
|
||||||
particleTransform->Position = glm::vec3(emitterTransform->Position.x, emitterTransform->Position.y, -9.5f + zDistribution);
|
particleTransform->Position = glm::vec3(emitterTransform->Position.x, emitterTransform->Position.y, -9.5f + zDistribution);
|
||||||
particleTransform->Scale = particleTemplate->Scale;
|
particleTransform->Scale = particleTemplate->Scale;
|
||||||
@@ -730,6 +730,7 @@ bool dd::Systems::PhysicsSystem::CreateParticleSequence(const Events::CreatePart
|
|||||||
particleEmitter->RadiusDistribution = event.RadiusDistribution;
|
particleEmitter->RadiusDistribution = event.RadiusDistribution;
|
||||||
particleEmitter->DefaultScale = event.DefaultScale;
|
particleEmitter->DefaultScale = event.DefaultScale;
|
||||||
particleEmitter->ScaleValues = event.ScaleValues;
|
particleEmitter->ScaleValues = event.ScaleValues;
|
||||||
|
particleEmitter->VelocityValues = event.VelocityValues;
|
||||||
{
|
{
|
||||||
//Creating Particle Template
|
//Creating Particle Template
|
||||||
auto particle = m_World->CreateEntity(emitter);
|
auto particle = m_World->CreateEntity(emitter);
|
||||||
|
|||||||
Reference in New Issue
Block a user