Axiom.ParticleFX.DirectionRandomizerAffector.AffectParticles C# (CSharp) Метод

AffectParticles() публичный Метод

Method called to allow the affector to 'do it's stuff' on all active particles in the system.
This is where the affector gets the chance to apply it's effects to the particles of a system. The affector is expected to apply it's effect to some or all of the particles in the system passed to it, depending on the affector's approach.
public AffectParticles ( ParticleSystem system, float timeElapsed ) : void
system ParticleSystem Reference to a ParticleSystem to affect.
timeElapsed float The number of seconds which have elapsed since the last call.
Результат void
		public override void AffectParticles( ParticleSystem system, float timeElapsed )
		{
			float length = 0.0f;

			foreach ( Particle p in system.Particles )
			{
				if ( _scope > Utility.UnitRandom() )
				{
					if ( !p.Direction.IsZeroLength )
					{
						if ( _keepVelocity )
						{
							length = p.Direction.Length;
						}

						p.Direction += new Vector3( Utility.RangeRandom( -_randomness, _randomness ) * timeElapsed,
													Utility.RangeRandom( -_randomness, _randomness ) * timeElapsed,
													Utility.RangeRandom( -_randomness, _randomness ) * timeElapsed );

						if ( _keepVelocity )
						{
							p.Direction *= length / p.Direction.Length;
						}
					}
				}
			}
		}