|
|
@@ -262,11 +262,21 @@ void ParticleEmitter2D::UpdateMaterial()
|
|
|
sourceBatches_[0].material_ = 0;
|
|
|
}
|
|
|
|
|
|
+URHO3D_EVENT(E_PARTICLESEND, ParticlesEnd) {
|
|
|
+}
|
|
|
+URHO3D_EVENT(E_PARTICLESDURATION, ParticlesDuration) {
|
|
|
+}
|
|
|
+
|
|
|
void ParticleEmitter2D::HandleScenePostUpdate(StringHash eventType, VariantMap& eventData)
|
|
|
{
|
|
|
using namespace ScenePostUpdate;
|
|
|
- float timeStep = eventData[P_TIMESTEP].GetFloat();
|
|
|
+ unsigned tests = (numParticles_ > 0 ? 1 : 0) | (emissionTime_ > 0.0f ? 2 : 0);
|
|
|
+ float timeStep = eventData[P_TIMESTEP].GetFloat();
|
|
|
Update(timeStep);
|
|
|
+ if ((tests & 2) && emissionTime_ == 0.0f)
|
|
|
+ SendEvent(E_PARTICLESDURATION); // emitting particles stoped
|
|
|
+ if ((tests & 1) && !numParticles_)
|
|
|
+ SendEvent(E_PARTICLESEND); // all particles over
|
|
|
}
|
|
|
|
|
|
void ParticleEmitter2D::Update(float timeStep)
|
|
|
@@ -297,7 +307,7 @@ void ParticleEmitter2D::Update(float timeStep)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (emissionTime_ >= 0.0f)
|
|
|
+ if (emissionTime_ > 0.0f)
|
|
|
{
|
|
|
float worldAngle = GetNode()->GetWorldRotation().RollAngle();
|
|
|
|