Merge branch 'master' into LevelSystemAndSuch
This commit is contained in:
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@@ -16,6 +16,7 @@ namespace Components
|
|||||||
struct Brick : Component
|
struct Brick : Component
|
||||||
{
|
{
|
||||||
int Score = 50;
|
int Score = 50;
|
||||||
|
//0 = empty, 1 = normal, 2 = multi-brick, 3 = lifebuoy, 4 = sticky, 5 = blaster, 6 = kraken
|
||||||
int Type = 0;
|
int Type = 0;
|
||||||
bool Removed = false;
|
bool Removed = false;
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
#include "Physics/CCircleShape.h"
|
#include "Physics/CCircleShape.h"
|
||||||
#include "Physics/CParticleEmitter.h"
|
#include "Physics/CParticleEmitter.h"
|
||||||
|
|
||||||
|
#include "Game/BrickComponents.h"
|
||||||
|
|
||||||
#include "Transform/TransformSystem.h"
|
#include "Transform/TransformSystem.h"
|
||||||
#include "Transform/TransformSystem.h"
|
#include "Transform/TransformSystem.h"
|
||||||
|
|
||||||
|
|||||||
@@ -690,10 +690,12 @@ bool dd::Systems::PhysicsSystem::OnContact(const dd::Events::Contact &event)
|
|||||||
{
|
{
|
||||||
//Check if it is a brick colliding
|
//Check if it is a brick colliding
|
||||||
auto brick = m_World->GetComponent<Components::Brick>(event.Entity1);
|
auto brick = m_World->GetComponent<Components::Brick>(event.Entity1);
|
||||||
|
EntityID entity = event.Entity1;
|
||||||
Components::Model* model;
|
Components::Model* model;
|
||||||
|
|
||||||
if (!brick) {
|
if (!brick) {
|
||||||
brick = m_World->GetComponent<Components::Brick>(event.Entity2);
|
brick = m_World->GetComponent<Components::Brick>(event.Entity2);
|
||||||
|
EntityID entity = event.Entity2;
|
||||||
if (!brick) {
|
if (!brick) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -704,21 +706,57 @@ bool dd::Systems::PhysicsSystem::OnContact(const dd::Events::Contact &event)
|
|||||||
else {
|
else {
|
||||||
model = m_World->GetComponent<Components::Model>(event.Entity1);
|
model = m_World->GetComponent<Components::Model>(event.Entity1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Spawn a particle when a brick collides with somthing
|
||||||
Events::CreateParticleSequence e;
|
Events::CreateParticleSequence e;
|
||||||
e.EmitterLifeTime = 4;
|
|
||||||
//- glm::atan(event.Normal.x, event.Normal.y
|
|
||||||
|
e.EmitterLifeTime = 3;
|
||||||
e.EmittingAngle = glm::half_pi<float>();
|
e.EmittingAngle = glm::half_pi<float>();
|
||||||
e.Spread = 0.5f;
|
e.Spread = 0.f;
|
||||||
e.NumberOfTicks = 1;
|
e.NumberOfTicks = 1;
|
||||||
e.ParticleLifeTime = 1.f;
|
e.ParticleLifeTime = 1.f;
|
||||||
e.ParticlesPerTick = 15;
|
e.ParticlesPerTick = 1;
|
||||||
e.Position = glm::vec3(event.IntersectionPoint.x, event.IntersectionPoint.y, -10);
|
e.Position = glm::vec3(event.IntersectionPoint.x, event.IntersectionPoint.y, -7);
|
||||||
e.Radius = 0.2f;
|
e.Color = glm::vec4(1.f);
|
||||||
e.SpriteFile = "Textures/Particles/Cloud_Particle.png";
|
e.Radius = 1.f;
|
||||||
e.Color = model->Color + glm::vec4(0.5f);
|
e.Speed = 0;
|
||||||
e.Speed = 100;
|
|
||||||
|
auto PowerFriend = m_World->GetComponent<Components::MultiBallBrick>(entity);
|
||||||
|
auto PowerSaviour = m_World->GetComponent<Components::LifebuoyBrick>(entity);
|
||||||
|
auto PowerSticky = m_World->GetComponent<Components::StickyBrick>(entity);
|
||||||
|
auto PowerInkBlaster = m_World->GetComponent<Components::InkBlasterBrick>(entity);
|
||||||
|
auto PowerKraken = m_World->GetComponent<Components::KrakenAttackBrick>(entity);
|
||||||
|
|
||||||
|
if (PowerFriend) {
|
||||||
|
e.SpriteFile = "Textures/PowerUps/Friends.png";
|
||||||
|
} else if (PowerSaviour) {
|
||||||
|
e.SpriteFile = "Textures/PowerUps/Saviour.png";
|
||||||
|
} else if (PowerSticky) {
|
||||||
|
e.SpriteFile = "Textures/PowerUps/Sticky.png";
|
||||||
|
} else if (PowerInkBlaster){
|
||||||
|
e.SpriteFile = "Textures/PowerUps/InkBlaster.png";
|
||||||
|
} else if (PowerKraken) {
|
||||||
|
e.SpriteFile = "Textures/PowerUps/RealeaseTheKraken.png";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
e.EmitterLifeTime = 4;
|
||||||
|
e.EmittingAngle = glm::half_pi<float>();
|
||||||
|
e.Spread = 0.5f;
|
||||||
|
e.NumberOfTicks = 1;
|
||||||
|
e.ParticleLifeTime = 1.f;
|
||||||
|
e.ParticlesPerTick = 15;
|
||||||
|
e.Position = glm::vec3(event.IntersectionPoint.x, event.IntersectionPoint.y, -10);
|
||||||
|
e.Radius = 0.2f;
|
||||||
|
e.SpriteFile = "Textures/Particles/Cloud_Particle.png";
|
||||||
|
e.Color = model->Color + glm::vec4(0.5f);
|
||||||
|
e.Speed = 100;
|
||||||
|
}
|
||||||
|
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user