Browse Source

Merge pull request #84 from capnlove/ParticlePlayerStop_Fix

ParticlePlayer Stop and Play functions now pause/unpause emitters
Simon Love 12 years ago
parent
commit
b98ddf0c3d
1 changed files with 6 additions and 6 deletions
  1. 6 6
      engine/source/2d/sceneobject/ParticlePlayer.cc

+ 6 - 6
engine/source/2d/sceneobject/ParticlePlayer.cc

@@ -401,14 +401,10 @@ void ParticlePlayer::integrateObject( const F32 totalTime, const F32 elapsedTime
     // Fetch the particle life-mode.
     // Fetch the particle life-mode.
     const ParticleAsset::LifeMode lifeMode = pParticleAsset->getLifeMode();
     const ParticleAsset::LifeMode lifeMode = pParticleAsset->getLifeMode();
 
 
-    // Finish if the particle player is in "infinite" mode.
-    if ( lifeMode == ParticleAsset::INFINITE )
-        return;
-
     // Are we waiting for particles and there are non left?
     // Are we waiting for particles and there are non left?
     if ( mWaitingForParticles )
     if ( mWaitingForParticles )
     {
     {
-        // Yes, so are there any particles left?
+		// Yes, so are there any particles left?
         if ( activeParticleCount == 0 )
         if ( activeParticleCount == 0 )
         {
         {
             // No, so stop the player immediately.
             // No, so stop the player immediately.
@@ -418,6 +414,10 @@ void ParticlePlayer::integrateObject( const F32 totalTime, const F32 elapsedTime
         return;
         return;
     }
     }
 
 
+	// Finish if the particle player is in "infinite" mode.
+    if ( lifeMode == ParticleAsset::INFINITE )
+        return;
+
     // Fetch the particle lifetime.
     // Fetch the particle lifetime.
     const F32 lifetime = pParticleAsset->getLifetime();
     const F32 lifetime = pParticleAsset->getLifetime();
 
 
@@ -793,7 +793,7 @@ bool ParticlePlayer::play( const bool resetParticles )
     {
     {
         // Fetch the emitter node.
         // Fetch the emitter node.
         EmitterNode* pEmitterNode = *emitterItr;
         EmitterNode* pEmitterNode = *emitterItr;
-
+		pEmitterNode->setPaused(false);
         // Reset the time since last generation.
         // Reset the time since last generation.
         pEmitterNode->setTimeSinceLastGeneration( 0.0f );
         pEmitterNode->setTimeSinceLastGeneration( 0.0f );
     }
     }