Example #1
0
 /// <summary>
 /// Set the Particle Systems Time according to PSTime variable, if put to 0 it will stop immediately
 /// </summary>
 public void UpdatePSTime()
 {
     //set the simulation time in every particle, minding the the simulation speed
     foreach (ParticleSystem PS in GetComponentsInChildren <ParticleSystem>())
     {
         var m = PS.main;
         m.loop = false;
         //To change the duration the particle needs to pe paused
         PS.Pause();
         m.duration = PSTime * m.simulationSpeed;
         //check if the particle is finished
         PS.Play();
         DisableTrail = (PS.time >= m.duration);
     }
 }