temporary particles for demo. trails for bricks, and on brick hit.

This commit is contained in:
Stiffly
2015-10-08 21:41:01 +02:00
parent 706e720ae8
commit 2545cef90f
9 changed files with 64 additions and 25 deletions
+19 -3
View File
@@ -189,20 +189,20 @@ void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBe
m_World->RemoveComponent<Components::Template>(brick);
auto transform = m_World->GetComponent<Components::Transform>(brick);
auto cBrick = m_World->GetComponent<Components::Brick>(brick);
if (typeInt == StandardBrick) {
} else if (typeInt == MultiBallBrick) {
cBrick->Type = MultiBallBrick;
auto model = m_World->GetComponent<Components::Model>(brick);
model->ModelFile = "Models/Brick/IceBrick.obj";
} else if (typeInt == LifebuoyBrick) {
cBrick->Type = LifebuoyBrick;
auto model = m_World->GetComponent<Components::Model>(brick);
model->Color = glm::vec4(1.f, 0.f, 0.f, .0f);
model->Color = glm::vec4(1.f, 0.f, 0.f, 1.f);
} else if (typeInt == StickyBrick) {
cBrick->Type = StickyBrick;
auto model = m_World->GetComponent<Components::Model>(brick);
model->Color = glm::vec4(0.f, 0.f, 1.f, .0f);
model->Color = glm::vec4(0.f, 0.f, 1.f, 1.f);
}
float x = line * spacesBetweenBricks.x;
float y = row * spacesBetweenBricks.y;
@@ -273,6 +273,7 @@ bool dd::Systems::LevelSystem::OnContact(const dd::Events::Contact &event)
auto transformComponentBrick = m_World->GetComponent<Components::Transform>(entityBrick);
auto transformComponentBall = m_World->GetComponent<Components::Transform>(entityBall);
auto brickModel = m_World->GetComponent<Components::Model>(entityBrick);
Events::SetImpulse e;
e.Entity = entityBrick;
@@ -291,6 +292,21 @@ bool dd::Systems::LevelSystem::OnContact(const dd::Events::Contact &event)
es.Score = brick->Score * ball->Combo;
EventBroker->Publish(es);
Events::CreateParticleSequence ep;
ep.parent = entityBrick;
ep.EmitterLifeTime = 1.f;
ep.ParticleLifeTime = 1.5f;
ep.ParticlesPerTick = 1;
ep.SpawnRate = 0.2;
ep.EmittingAngle = glm::half_pi<float>();
ep.Spread = 1.5f;
ep.Position = transformComponentBrick->Position;
ep.Radius = 0.05;
ep.SpriteFile = "Textures/Particles/FadeBall.png";
ep.Color = brickModel->Color + glm::vec4(1);
ep.Speed = 50;
EventBroker->Publish(ep);
//std::cout << "Combo: " << ball->Combo << std::endl;
//std::cout << NumberOfBricks() << std::endl;
//std::cout << "Brick Score: " << brick->Score << std::endl;