Water splash
This commit is contained in:
+1
-1
Submodule assets updated: 78ba667b37...a6e3f120fd
@@ -20,6 +20,7 @@ struct ParticleEmitter : Component
|
||||
, SpreadAngle(0)
|
||||
, LifeTime(0)
|
||||
, TimeSinceLastSpawn(100)
|
||||
, Emitting(false)
|
||||
, Color(glm::vec4(0)) { }
|
||||
|
||||
EntityID ParticleTemplate;
|
||||
@@ -32,6 +33,7 @@ struct ParticleEmitter : Component
|
||||
double LifeTime;
|
||||
bool UseGoalVelocity;
|
||||
bool Fade;
|
||||
bool Emitting;
|
||||
glm::vec3 GoalVelocity;
|
||||
std::vector<float> AngularVelocitySpectrum;
|
||||
std::vector<glm::vec3> OrientationSpectrum; //Keep? noo..
|
||||
|
||||
@@ -9,8 +9,10 @@ namespace Events
|
||||
{
|
||||
struct CreateExplosion : Event
|
||||
{
|
||||
CreateExplosion()
|
||||
: Color(glm::vec4(0)) {}
|
||||
CreateExplosion() :
|
||||
Color(glm::vec4(0)),
|
||||
UseGoalVector(false) {}
|
||||
|
||||
glm::vec3 Position;
|
||||
glm::vec4 Color;
|
||||
double LifeTime;
|
||||
@@ -20,6 +22,10 @@ namespace Events
|
||||
float Speed;
|
||||
float SpreadAngle;
|
||||
std::vector<float> ParticleScale;
|
||||
bool UseGoalVector;
|
||||
glm::vec3 GoalVelocity;
|
||||
bool Emitting;
|
||||
float SpawnFrequency;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -49,11 +49,15 @@ void Systems::ParticleSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
{
|
||||
emitterComponent->TimeSinceLastSpawn += dt;
|
||||
auto emitterTransformComponent = m_World->GetComponent<Components::Transform>(entity);
|
||||
// if(emitterComponent->TimeSinceLastSpawn > emitterComponent->SpawnFrequency)
|
||||
// {
|
||||
// SpawnParticles(entity);
|
||||
// emitterComponent->TimeSinceLastSpawn = 0;
|
||||
// }
|
||||
if(emitterComponent->Emitting)
|
||||
{
|
||||
if(emitterComponent->TimeSinceLastSpawn > emitterComponent->SpawnFrequency)
|
||||
{
|
||||
SpawnParticles(entity);
|
||||
emitterComponent->TimeSinceLastSpawn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
auto particleComponent = m_World->GetComponent<Components::Particle>(entity);
|
||||
@@ -242,10 +246,17 @@ bool Systems::ParticleSystem::CreateExplosion(const Events::CreateExplosion &e)
|
||||
emitter->SpawnCount = e.ParticlesToSpawn;
|
||||
emitter->Speed = e.Speed;
|
||||
emitter->SpreadAngle = e.SpreadAngle;
|
||||
emitter->Emitting = e.Emitting;
|
||||
emitter->SpawnFrequency = e.SpawnFrequency;
|
||||
//emitter->ScaleSpectrum.push_back(glm::vec3(e.ParticleScale));
|
||||
emitter->SpawnFrequency = e.LifeTime + 20; //temp
|
||||
emitter->Fade = true;
|
||||
emitter->Color = e.Color;
|
||||
if(e.UseGoalVector)
|
||||
{
|
||||
emitter->UseGoalVelocity = e.UseGoalVector;
|
||||
emitter->GoalVelocity = e.GoalVelocity;
|
||||
}
|
||||
std::vector<glm::vec3> scale;
|
||||
scale.push_back(glm::vec3(e.ParticleScale[0]));
|
||||
if(e.ParticleScale.size() >= 2)
|
||||
|
||||
@@ -102,12 +102,14 @@ void Systems::TankSteeringSystem::UpdateEntity(double dt, EntityID entity, Entit
|
||||
e.LifeTime = 1.5;
|
||||
e.ParticleScale.push_back(0.6);
|
||||
e.ParticleScale.push_back(1.8);
|
||||
e.ParticlesToSpawn = 5;
|
||||
e.ParticlesToSpawn = 1;
|
||||
e.Position = cloneTransform->Position;
|
||||
e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
|
||||
e.Speed = 1.7;
|
||||
e.SpreadAngle = glm::pi<float>()/10;
|
||||
e.SpreadAngle = glm::pi<float>()/100;
|
||||
e.spritePath = "Textures/Sprites/Smoke1.png";
|
||||
e.Emitting = true;
|
||||
e.SpawnFrequency = 0.2;
|
||||
e.Color = glm::vec4(0.6,0.6,0.6,1);
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
@@ -192,36 +194,65 @@ bool Systems::TankSteeringSystem::OnCollision(const Events::Collision &e)
|
||||
//auto otherTransform = m_World->GetComponent<Components::Transform>(otherEntity);
|
||||
|
||||
{
|
||||
// Events::CreateExplosion e;
|
||||
// e.LifeTime = 3;
|
||||
// e.ParticleScale.push_back(8);
|
||||
// e.ParticlesToSpawn = 20;
|
||||
// e.Position = shellTransform->Position;
|
||||
// e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
|
||||
// e.Speed = 3;
|
||||
// e.SpreadAngle = glm::pi<float>();
|
||||
// e.spritePath = "Textures/Sprites/Smoke1.png";
|
||||
// e.Color = glm::vec4(0.6,0.6,0.6,1);
|
||||
// EventBroker->Publish(e);
|
||||
// e.LifeTime = 0.7;
|
||||
// e.ParticleScale.push_back(12);
|
||||
// e.ParticlesToSpawn = 10;
|
||||
// e.Position = shellTransform->Position;
|
||||
// e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
|
||||
// e.Speed = 17;
|
||||
// e.SpreadAngle = glm::pi<float>();
|
||||
// e.spritePath = "Textures/Sprites/Fire.png";
|
||||
// EventBroker->Publish(e);
|
||||
// e.LifeTime = 0.2;
|
||||
// e.ParticleScale.push_back(1);
|
||||
// e.ParticleScale.push_back(15);
|
||||
// e.ParticlesToSpawn = 5;
|
||||
// e.Position = shellTransform->Position;
|
||||
// e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
|
||||
// e.Speed = 6;
|
||||
// e.SpreadAngle = glm::pi<float>();
|
||||
// e.spritePath = "Textures/Sprites/Blast1.png";
|
||||
// e.Color = glm::vec4(2, 2, 2, 0.2);
|
||||
// EventBroker->Publish(e);
|
||||
|
||||
Events::CreateExplosion e;
|
||||
e.LifeTime = 3;
|
||||
e.ParticleScale.push_back(8);
|
||||
e.LifeTime = 1;
|
||||
e.ParticleScale.push_back(1);
|
||||
e.ParticleScale.push_back(3);
|
||||
e.ParticlesToSpawn = 20;
|
||||
e.Position = shellTransform->Position;
|
||||
e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
|
||||
e.Speed = 3;
|
||||
e.SpreadAngle = glm::pi<float>();
|
||||
e.spritePath = "Textures/Sprites/Smoke1.png";
|
||||
e.Color = glm::vec4(0.6,0.6,0.6,1);
|
||||
EventBroker->Publish(e);
|
||||
e.LifeTime = 0.7;
|
||||
e.ParticleScale.push_back(12);
|
||||
e.ParticlesToSpawn = 10;
|
||||
e.Position = shellTransform->Position;
|
||||
e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
|
||||
e.Speed = 17;
|
||||
e.SpreadAngle = glm::pi<float>();
|
||||
e.spritePath = "Textures/Sprites/Fire.png";
|
||||
EventBroker->Publish(e);
|
||||
e.LifeTime = 0.2;
|
||||
e.ParticleScale.push_back(1);
|
||||
e.ParticleScale.push_back(15);
|
||||
e.ParticlesToSpawn = 5;
|
||||
e.Position = shellTransform->Position;
|
||||
e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
|
||||
e.SpreadAngle = glm::radians<float>(180) / 4;
|
||||
e.RelativeUpOrientation = glm::angleAxis(glm::radians<float>(90), glm::vec3(1,0,0));
|
||||
e.UseGoalVector = true;
|
||||
e.GoalVelocity = glm::vec3(0,-4,0);
|
||||
e.Speed = 6;
|
||||
e.SpreadAngle = glm::pi<float>();
|
||||
e.spritePath = "Textures/Sprites/Blast1.png";
|
||||
e.Color = glm::vec4(2, 2, 2, 0.2);
|
||||
e.spritePath = "Textures/Sprites/Splash.png";
|
||||
e.Color = glm::vec4(5.f,5.f,5.f,1);
|
||||
|
||||
EventBroker->Publish(e);
|
||||
e.LifeTime = 1;
|
||||
e.ParticleScale.push_back(1);
|
||||
e.ParticleScale.push_back(3);
|
||||
e.ParticlesToSpawn = 20;
|
||||
e.Position = shellTransform->Position;
|
||||
e.SpreadAngle = glm::radians<float>(180)/ 4;
|
||||
e.RelativeUpOrientation = glm::angleAxis(glm::radians<float>(90), glm::vec3(1,0,0));
|
||||
e.UseGoalVector = true;
|
||||
e.GoalVelocity = glm::vec3(0,-4,0);
|
||||
e.Speed = 6;
|
||||
e.spritePath = "Textures/Sprites/Splash.png";
|
||||
e.Color = glm::vec4(1.f,1.f,1.f,1);
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user