public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator) { Vector3 deltaColorFirst = _medianColor - _initialColor; Vector3 deltaColorLast = _finalColor - _medianColor; Particle particle = iterator.First; do { if (particle.Age < _median) { float ageMultiplier = particle.Age / _median; particle.Color.X = _initialColor.X + deltaColorFirst.X * ageMultiplier; particle.Color.Y = _initialColor.Y + deltaColorFirst.Y * ageMultiplier; particle.Color.Z = _initialColor.Z + deltaColorFirst.Z * ageMultiplier; } else { float ageMultiplier = (particle.Age - _median) / (1f - _median); particle.Color.X = _medianColor.X + deltaColorLast.X * particle.Age; particle.Color.Y = _medianColor.Y + deltaColorLast.Y * particle.Age; particle.Color.Z = _medianColor.Z + deltaColorLast.Z * particle.Age; } } while (iterator.MoveNext(ref particle)); }
public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) { var radiusSq = Radius * Radius; while (iterator.HasNext) { var particle = iterator.Next(); var localPos = particle->Position - particle->TriggerPos; var distSq = localPos.LengthSquared(); var normal = localPos.ToAxis().ToVector2(); if (Inside) { if (distSq < radiusSq) continue; SetReflected(distSq, particle, normal); } else { if (distSq > radiusSq) continue; SetReflected(distSq, particle, -normal); } } }
public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) { while (iterator.HasNext) { var particle = iterator.Next(); var left = particle->TriggerPos.X + Width * -0.5f; var right = particle->TriggerPos.X + Width * 0.5f; var top = particle->TriggerPos.Y + Height * -0.5f; var bottom = particle->TriggerPos.Y + Height * 0.5f; var xPos = particle->Position.X; var yPos = particle->Position.Y; if ((int)particle->Position.X < left) { xPos = particle->Position.X + Width; } else if ((int)particle->Position.X > right) { xPos = particle->Position.X - Width; } if ((int)particle->Position.Y < top) { yPos = particle->Position.Y + Height; } else if ((int)particle->Position.Y > bottom) { yPos = particle->Position.Y - Height; } particle->Position = new Vector2(xPos, yPos); } }
private void CullPCB() { int count = mPSL.Count; ParticleBuffer[] pba = new ParticleBuffer[count]; mParticleCBuffer.GetData(pba); int endNum = mPCpt + ParticleQuantityPerFrame > count ? count : mPCpt + ParticleQuantityPerFrame; for (int i = mPCpt; i < endNum; i++) { if (mPSL[i] != null) { if (pba[i].playMode == 0) { mPSL[i].Play(); } else if (pba[i].playMode == 1) { mPSL[i].Pause(); } else if (pba[i].playMode == 2) { if (mPSL[i].isPaused) { mPSL[i].Play(); } mPSL[i].Stop(); } } } mPCpt = mPCpt + ParticleQuantityPerFrame > count ? 0 : mPCpt + ParticleQuantityPerFrame; }
public void Update(ParticleBuffer particleBuffer, float timeSinceLastFrame, Emitter parent) { var emitterCoordinates = parent.WorldCoordinates; // Update existing particles var particles = particleBuffer.Particles; for (var particleIndex = 0; particleIndex < particles.Length; particleIndex++) { ref var particle = ref particles[particleIndex]; if (!particle.IsAlive) { continue; } particle.TimeAlive += timeSinceLastFrame; if (particle.TimeAlive > MaxParticleLifeTime) { particle.IsAlive = false; continue; } // modifiers { particle.TextureSectionIndex = (byte)((particle.TimeAlive / MaxParticleLifeTime) * TextureSections.Length); } // position modifier particle.Position += particle.Velocity * timeSinceLastFrame; particle.RotationInRadians += particle.RotationalVelocityInRadians * timeSinceLastFrame; }
public void IsIdempotent() { var subject = new ParticleBuffer(100); subject.Dispose(); subject.Dispose(); }
public void WhenBufferIsSequential_CopiesParticlesInReverseOrder() { unsafe { var subject = new ParticleBuffer(10); var iterator = subject.Release(5); do { var particle = iterator.Next(); particle->Age = 1f; }while (iterator.HasNext); var destination = new Particle[10]; fixed(Particle *buffer = destination) { subject.CopyToReverse((IntPtr)buffer); } Assert.AreEqual(destination[0].Age, 1f, 0.0001); Assert.AreEqual(destination[1].Age, 1f, 0.0001); Assert.AreEqual(destination[2].Age, 1f, 0.0001); Assert.AreEqual(destination[3].Age, 1f, 0.0001); Assert.AreEqual(destination[4].Age, 1f, 0.0001); } }
public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) { var velocityThreshold2 = VelocityThreshold * VelocityThreshold; while (iterator.HasNext) { var particle = iterator.Next(); var velocity2 = particle->Velocity.X * particle->Velocity.X + particle->Velocity.Y * particle->Velocity.Y; var deltaColor = VelocityColor - StationaryColor; if (velocity2 >= velocityThreshold2) { VelocityColor.CopyTo(out particle->Color); } else { var t = (float)Math.Sqrt(velocity2) / VelocityThreshold; particle->Color = new HslColor( deltaColor.H * t + StationaryColor.H, deltaColor.S * t + StationaryColor.S, deltaColor.L * t + StationaryColor.L); } } }
public void WhenSomeParticlesReleased_ReturnsAvailableCount() { var subject = new ParticleBuffer(100); subject.Release(10); Assert.AreEqual(subject.Available, 90); }
public void WhenAllParticlesReleased_ReturnsZero() { var subject = new ParticleBuffer(100); subject.Release(100); Assert.AreEqual(subject.Count, 100); }
internal override void ExecuteModifiers(UpdateContext updateContext, ParticleModifierCollection modifiers, ref ParticleBuffer.Iterator iterator) { foreach (ParticleModifier modifier in modifiers) { modifier.Process(updateContext, ref iterator); iterator.Reset(); } }
public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) { while (iterator.HasNext) { var particle = iterator.Next(); particle->Opacity = 1.0f - particle->Age; } }
public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator) { Particle particle = iterator.First; do { particle.Rotation = FlaiMath.GetAngle(particle.Velocity); } while (iterator.MoveNext(ref particle)); }
public void WhenPassedReasonableQuantity_ReturnsNumberReleased() { var subject = new ParticleBuffer(100); var count = subject.Release(50); Assert.AreEqual(count.Total, 50); }
public void WhenPassedImpossibleQuantity_ReturnsNumberActuallyReleased() { var subject = new ParticleBuffer(100); var count = subject.Release(200); Assert.AreEqual(count.Total, 100); }
internal override void ExecuteModifiers(UpdateContext updateContext, ParticleModifierCollection modifiers, ref ParticleBuffer.Iterator iterator) { ParticleBuffer.Iterator iter = iterator; // make sure that the iterator is always copied, so that all modifiers don't concurrently process the same iterator System.Threading.Tasks.Parallel.ForEach(modifiers, modifier => { ParticleBuffer.Iterator iterInner = iter; // make sure that the iterator is always copied, so that all modifiers don't concurrently process the same iterator modifier.Process(updateContext, ref iterInner); }); }
public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator) { float scaleDelta = _finalScale - _initialScale; Particle particle = iterator.First; do { particle.Scale = _initialScale + scaleDelta * particle.Age; } while (iterator.MoveNext(ref particle)); }
public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator) { float opacityDelta = _finalOpacity - _initialOpacity; Particle particle = iterator.First; do { particle.Opacity = _initialOpacity + opacityDelta * particle.Age; } while (iterator.MoveNext(ref particle)); }
public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) { var rotationRateDelta = RotationRate * elapsedSeconds; while (iterator.HasNext) { var particle = iterator.Next(); particle->Rotation += rotationRateDelta; } }
public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) { var delta = FinalScale - InitialScale; while (iterator.HasNext) { var particle = iterator.Next(); particle->Scale = delta * particle->Age + InitialScale; } }
public void WhenPassedReasonableNumber_ReclaimsParticles() { var subject = new ParticleBuffer(100); subject.Release(100); Assert.AreEqual(subject.Count, 100); subject.Reclaim(50); Assert.AreEqual(subject.Count, 50); }
public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator) { float hueChange = this.HueShiftAmount * updateContext.DeltaSeconds * FlaiMath.Pi / 180f; Matrix hueShiftMatrix = HueShifter.CreateHueTransformationMatrix(hueChange); Particle particle = iterator.First; do { HueShifter.Shift(ref particle.Color, ref hueShiftMatrix); } while (iterator.MoveNext(ref particle)); }
public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator) { Vector3 deltaColor = _finalColor - _initialColor; Particle particle = iterator.First; do { particle.Color.X = _initialColor.X + deltaColor.X * particle.Age; particle.Color.Y = _initialColor.Y + deltaColor.Y * particle.Age; particle.Color.Z = _initialColor.Z + deltaColor.Z * particle.Age; } while (iterator.MoveNext(ref particle)); }
public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) { while (iterator.HasNext) { var particle = iterator.Next(); var drag = -DragCoefficient * Density * particle->Mass * elapsedSeconds; particle->Velocity = new Vector2( particle->Velocity.X + particle->Velocity.X * drag, particle->Velocity.Y + particle->Velocity.Y * drag); } }
public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator) { const float Multiplier = 200; float tempAttractionPower = this.AttractionPower * updateContext.DeltaSeconds * Multiplier; Particle particle = iterator.First; do { float distance = Vector2.Distance(this.AttractionPoint, particle.Position); particle.Velocity += (this.AttractionPoint - particle.Position) * tempAttractionPower / distance; } while (iterator.MoveNext(ref particle)); }
public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) { var vector = Direction * (Strength * elapsedSeconds); while (iterator.HasNext) { var particle = iterator.Next(); particle->Velocity = new Vector2( particle->Velocity.X + vector.X * particle->Mass, particle->Velocity.Y + vector.Y * particle->Mass); } }
public void Can_Fit_More_Particles_Than_Initial_Capacity() { var buffer = new ParticleBuffer(new ParticlePool(), 10); for (var x = 0; x < 11; x++) { buffer.Add(new Particle { IsAlive = true }); } buffer.Particles.Length.ShouldBe(11); }
public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) { var delta = FinalHue - InitialHue; while (iterator.HasNext) { var particle = iterator.Next(); particle->Color = new HslColor( delta * particle->Age + InitialHue, particle->Color.S, particle->Color.L); } }
public void Dead_Particles_At_Edge_Are_Not_Returned_In_Particle_List() { var buffer = new ParticleBuffer(new ParticlePool(), 10); for (var x = 0; x < 10; x++) { var isDead = x == 0 || x == 9; buffer.Add(new Particle { IsAlive = !isDead }); } buffer.Particles.Length.ShouldBe(8); }
public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator) { if (this.RotationRate <= float.Epsilon) { return; } float deltaRotation = this.RotationRate * updateContext.DeltaSeconds; Particle particle = iterator.First; do { particle.Rotation += deltaRotation; } while (iterator.MoveNext(ref particle)); }
public void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) { while (iterator.HasNext) { var particle = iterator.Next(); var diff = Position + particle->TriggerPos - particle->Position; var distance2 = diff.LengthSquared(); var speedGain = _gravConst * Mass / distance2 * elapsedSeconds; // normalize distances and multiply by speedGain particle->Velocity += diff.ToAxis() * speedGain; } }
private void CreateParticleBuffer(int count) { if (mParticleCBuffer != null) { mParticleCBuffer.Release(); } mParticleCBuffer = new ComputeBuffer(count, sizeof(float) * 3 + sizeof(int)); ParticleBuffer[] buffers = new ParticleBuffer[count]; for (int i = 0; i < count; i++) { InitParticleBuffer(ref buffers[i], i); } mParticleCBuffer.SetData(buffers); }
public unsafe void Update(float elapsedseconds, ParticleBuffer.ParticleIterator iterator) { var delta = new HslColor(FinalColor.H - InitialColor.H, FinalColor.S - InitialColor.S, FinalColor.L - InitialColor.L); while (iterator.HasNext) { var particle = iterator.Next(); particle->Color = new HslColor( InitialColor.H + delta.H * particle->Age, InitialColor.S + delta.S * particle->Age, InitialColor.L + delta.L * particle->Age); } }
public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator) { float deltaStrength = this.Strength * updateContext.DeltaSeconds; if (deltaStrength == 0f || _direction == Vector2.Zero) { return; } Vector2 deltaGravity = _direction * deltaStrength; Particle particle = iterator.First; do { particle.Velocity += deltaGravity; } while (iterator.MoveNext(ref particle)); }
public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator) { if (this.DampingPower <= float.Epsilon) { return; } float inverseDampingDelta = -this.DampingPower * updateContext.DeltaSeconds; Particle particle = iterator.First; do { particle.Velocity.X += particle.Velocity.X * inverseDampingDelta; // inverse velocity particle.Velocity.Y += particle.Velocity.Y * inverseDampingDelta; // inverse velocity } while (iterator.MoveNext(ref particle)); }
public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator) { Particle particle = iterator.First; float maxSpeedSquared = _maximumSpeed * _maximumSpeed; do { float speedSquared = particle.Velocity.X * particle.Velocity.X + particle.Velocity.Y * particle.Velocity.Y; if (speedSquared > maxSpeedSquared) { particle.Velocity.Normalize(); particle.Velocity *= _maximumSpeed; } } while (iterator.MoveNext(ref particle)); }
public ParticleEmitter(int budget, float particleLifeTime, EmitterStyle emitterStyle) { Ensure.True(budget > 0); Ensure.IsValid(particleLifeTime); Ensure.True(particleLifeTime >= 0); Ensure.NotNull(emitterStyle); _particleBuffer = new ParticleBuffer(budget); _particleLifeTime = particleLifeTime; _emitterStyle = emitterStyle; this.Modifiers = new ParticleModifierCollection(); this.ReleaseParameters = new ReleaseParameters(); this.ExecutionStrategy = ModifierExecutionStrategy.Serial; this.Enabled = true; }
public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator) { float opacityDeltaFirst = _medianOpacity - _initialOpacity; float opacityDeltaLast = _finalOpacity - _medianOpacity; Particle particle = iterator.First; do { if (particle.Age < _median) { particle.Opacity = _initialOpacity + opacityDeltaFirst * (particle.Age / _median); } else { particle.Opacity = _medianOpacity + opacityDeltaLast * (particle.Age - _median) / (1f - _median); } } while (iterator.MoveNext(ref particle)); }
public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator) { float scaleDeltaFirst = _medianScale - _initialScale; float scaleDeltaLast = _finalScale - _medianScale; Particle particle = iterator.First; do { if (particle.Age < _median) { particle.Scale = _initialScale + scaleDeltaFirst * (particle.Age / _median); } else { particle.Scale = _medianScale + scaleDeltaLast * (particle.Age - _median) / (1f - _median); } } while (iterator.MoveNext(ref particle)); }
public void Update(ParticleBuffer particleBuffer, float timeSinceLastFrame, Emitter parent) { var emitterCoordinates = parent.WorldCoordinates; // Update existing particles var particles = particleBuffer.Particles; for (var particleIndex = 0; particleIndex < particles.Length; particleIndex++) { ref var particle = ref particles[particleIndex]; if (!particle.IsAlive) { continue; } particle.TimeAlive += timeSinceLastFrame; if (particle.TimeAlive > MaxParticleLifeTime) { particle.IsAlive = false; continue; } // modifiers { particle.Velocity += timeSinceLastFrame * new Vector2(ConstantAccelerationX, ConstantAccelerationY); } { particle.Size += timeSinceLastFrame * new Vector2(ConstantSizeWidthChangePerSecond, ConstantSizeHeightChangePerSecond); } { particle.CurrentRed -= (((particle.InitialRed - EndingColorRed) / MaxParticleLifeTime) * timeSinceLastFrame); particle.CurrentGreen -= (((particle.InitialGreen - EndingColorGreen) / MaxParticleLifeTime) * timeSinceLastFrame); particle.CurrentBlue -= (((particle.InitialBlue - EndingColorBlue) / MaxParticleLifeTime) * timeSinceLastFrame); particle.CurrentAlpha -= (((particle.InitialAlpha - EndingColorAlpha) / MaxParticleLifeTime) * timeSinceLastFrame); } // position modifier particle.Position += particle.Velocity * timeSinceLastFrame; particle.RotationInRadians += particle.RotationalVelocityInRadians * timeSinceLastFrame; }
public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator) { Particle particle = iterator.First; if (_noiseSpeedMultiplier == 1) { do { particle.Opacity = _initialOpacity - _initialOpacity * particle.Age; } while (iterator.MoveNext(ref particle)); } else { float multiplier = _initialOpacity * _noiseSpeedMultiplier + _initialOpacity; do { particle.Opacity = _initialOpacity - _initialOpacity * (1 + (multiplier - 1) * particle.Noise) * particle.Age; // with this opacity can go below zero } while (iterator.MoveNext(ref particle)); } }
public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) { while (iterator.HasNext) { var particle = iterator.Next(); var left = particle->TriggerPos.X + Width * -0.5f; var right = particle->TriggerPos.X + Width * 0.5f; var top = particle->TriggerPos.Y + Height * -0.5f; var bottom = particle->TriggerPos.Y + Height * 0.5f; var xPos = particle->Position.X; var xVel = particle->Velocity.X; var yPos = particle->Position.Y; var yVel = particle->Velocity.Y; if ((int)particle->Position.X < left) { xPos = left + (left - xPos); xVel = -xVel * RestitutionCoefficient; } else if (particle->Position.X > right) { xPos = right - (xPos - right); xVel = -xVel * RestitutionCoefficient; } if (particle->Position.Y < top) { yPos = top + (top - yPos); yVel = -yVel * RestitutionCoefficient; } else if ((int)particle->Position.Y > bottom) { yPos = bottom - (yPos - bottom); yVel = -yVel * RestitutionCoefficient; } particle->Position = new Vector2(xPos, yPos); particle->Velocity = new Vector2(xVel, yVel); } }
public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) { var velocityThreshold2 = VelocityThreshold * VelocityThreshold; while (iterator.HasNext) { var particle = iterator.Next(); var velocity2 = particle->Velocity.LengthSquared(); float h; if (velocity2 >= velocityThreshold2) { h = VelocityHue; } else { var t = (float)Math.Sqrt(velocity2) / VelocityThreshold; h = MathHelper.Lerp(StationaryHue, VelocityHue, t); } particle->Color = new HslColor(h, particle->Color.S, particle->Color.L); } }
private void UpdateParticleBuffers() { if (m_pBuffers == null || m_pBuffers.Length != m_psList.Count) { var newBuffers = new ParticleBuffer[m_psList.Count]; if (m_pBuffers != null && m_pBuffers.Length > 0) { for (int i = 0; i < newBuffers.Length; ++i) { if (i < m_pBuffers.Length) { newBuffers[i] = m_pBuffers[i]; } } } m_pBuffers = newBuffers; } for (int i = 0; i < m_pBuffers.Length; ++i) { ParticleBuffer pb = m_pBuffers[i]; if (pb == null) { pb = new ParticleBuffer(); } pb.ps = m_psList[i]; if (pb.ps != null) { int pCount = pb.ps.main.maxParticles; if (pb.particles == null || pb.particles.Length != pCount) { pb.particles = new ParticleSystem.Particle[pCount]; } } m_pBuffers[i] = pb; } }
public void WhenNoParticlesReleased_ReturnsBufferSize() { var subject = new ParticleBuffer(100); Assert.AreEqual(subject.Available, 100); }
private void InitParticleBuffer(ref ParticleBuffer pBuffer, int index) { pBuffer = new ParticleBuffer(); pBuffer.pos = mPSL[index].transform.position; pBuffer.playMode = 0; }
public ParticlesEffect(bool IsEmitterParameters, string ProfileName, IGraphicsDeviceService graphics, Vector2 Position, string DefinitionsTextureRegion, int DefinitionsCapacity, float LifeSpanFromMilliseconds, float BoxFillWidth, float BoxFillHeight, float BoxWidth, float BoxHeight, float BoxUniformWidth, float BoxUniformHeight, float CircleRadius, string CircleRadiate, float LineAxisX, float LineAxisY, float LineLength, bool PointIsPoint, float RingRadius, string RingRadiate, float SprayDirectionX, float SprayDirectionY, float SpraySpread, Microsoft.Xna.Framework.Color ParametersColorMin, float ParametersMassMin, float ParametersOpacityMin, int ParametersQuantityMin, float ParametersRotationMin, float ParametersScaleMin, float ParametersSpeedMin, float ParametersMassMax, float ParametersOpacityMax, int ParametersQuantityMax, float ParametersRotationMax, float ParametersScaleMax, float ParametersSpeedMax, string ContainerModifierSelectedName, bool IsContainerModifierSelected, bool CircleContainerModifierInside, float CircleContainerModifierRadius, float CircleContainerModifierRestitutionCoefficient, int RectangleContainerModifierWidth, int RectangleContainerModifierHeight, float RectangleContainerModifierRestitutionCoefficient, int RectangleLoopContainerModifierWidth, int RectangleLoopContainerModifierHeight, string ModifiersInterpolatorsSelectedName, Microsoft.Xna.Framework.Color AgeModifierColorInterpolatorStartValue, Microsoft.Xna.Framework.Color AgeModifierColorInterpolatorEndValue, float AgeModifierHueInterpolatorStartValue, float AgeModifierHueInterpolatorEndValue, float AgeModifierOpacityInterpolatorStartValue, float AgeModifierOpacityInterpolatorEndValue, float AgeModifierRotationInterpolatorStartValue, float AgeModifierRotationInterpolatorEndValue, float AgeModifierScaleInterpolatorStartValueX, float AgeModifierScaleInterpolatorStartValueY, float AgeModifierScaleInterpolatorEndValueX, float AgeModifierScaleInterpolatorEndValueY, Microsoft.Xna.Framework.Color VelocityModifierColorInterpolatorStartValue, Microsoft.Xna.Framework.Color VelocityModifierColorInterpolatorEndValue, float VelocityModifierHueInterpolatorStartValue, float VelocityModifierHueInterpolatorEndValue, float VelocityModifierOpacityInterpolatorStartValue, float VelocityModifierOpacityInterpolatorEndValue, float VelocityModifierRotationInterpolatorStartValue, float VelocityModifierRotationInterpolatorEndValue, float VelocityModifierScaleInterpolatorStartValueX, float VelocityModifierScaleInterpolatorStartValueY, float VelocityModifierScaleInterpolatorEndValueX, float VelocityModifierScaleInterpolatorEndValueY, bool IsDragModifierSelected, float DragModifierDragCoefficient, float DragModifierDensity, bool IsLinearGravityModifierSelected, float LinearGravityModifierDirectionX, float LinearGravityModifierDirectionY, float LinearGravityModifierStrength, int LinearGravityModifierControlSizeBuffer, float LinearGravityModifierControlDuration, bool IsOpacityFastFadeModifierSelected, float OpacityFastFadeModifierControlDuration, int OpacityFastFadeModifierControlSizeBuffer, bool IsRotationModifierRotationRate, float RotationModifierRotationRate, bool IsVelocityColorModifierSelected, Microsoft.Xna.Framework.Color VelocityColorModifierVelocityColor, Microsoft.Xna.Framework.Color VelocityColorModifierStationaryColor, bool IsVelocityModifierInterpolatorSelected, float VelocityColorModifierVelocityThreshold, float VelocityModifierVelocityThreshold, string VelocityModifiersInterpolatorsSelectedName, bool IsVortexModifierSelected, float VortexModifierMass, float VortexModifierMaxSpeed, float VortexModifierPositionX, float VortexModifierPositionY, Texture2D TextBoxTextureRegionDefinitions, int TextBoxCapacityDefinitions, float TextBoxLifeSpanDefinitions) { positionParticle = Position; this.BoxWidth = BoxWidth; this.BoxHeight = BoxHeight; this.BoxFillWidth = BoxFillWidth; this.BoxFillHeight = BoxFillHeight; this.BoxUniformWidth = BoxUniformWidth; this.BoxUniformHeight = BoxUniformHeight; this.CircleRadius = CircleRadius; this.LineAxisX = LineAxisX; this.LineAxisY = LineAxisY; this.LineLength = LineLength; this.RingRadius = RingRadius; this.SpraySpread = SpraySpread; this.SprayDirectionX = SprayDirectionX; this.SprayDirectionY = SprayDirectionY; this.CircleRadiate = CircleRadiate; this.RingRadiate = RingRadiate; if (texture != null) { texture.Dispose(); } if (string.IsNullOrEmpty(DefinitionsTextureRegion)) { texture = CreateTexture(graphics.GraphicsDevice, 5, 5, pixel => Color.White); } else { texture = Texture2D.FromStream(graphics.GraphicsDevice, new FileStream(DefinitionsTextureRegion, FileMode.Open, FileAccess.Read, FileShare.Read)); } textureRegion = new TextureRegion2D(texture); if (LifeSpanFromMilliseconds == 1) { this.lifeSpan = 5; } else { this.lifeSpan = LifeSpanFromMilliseconds; } particle = new ParticleEffect(); particle.Position = Position; particle.Emitters = new List <ParticleEmitter>(); File.WriteAllText(@"D:\GameDevelop\HomeParticlesSoftware\HomeParticlesSoftware\traceText\test.txt", String.Empty); using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"D:\GameDevelop\HomeParticlesSoftware\HomeParticlesSoftware\traceText\test.txt", true)) { file.WriteLine("ProfileUsed : " + GetProfile(ProfileName).ToString()); file.WriteLine("ProfileName : " + ProfileName); file.WriteLine("Position : " + Position); file.WriteLine("DefinitionsTextureRegion : " + DefinitionsTextureRegion); file.WriteLine("DefinitionsCapacity : " + DefinitionsCapacity); file.WriteLine("LifeSpanFromMilliseconds : " + LifeSpanFromMilliseconds); file.WriteLine("BoxFillWidth : " + BoxFillWidth); file.WriteLine("BoxFillHeight : " + BoxFillHeight); file.WriteLine("BoxWidth : " + BoxWidth); file.WriteLine("BoxHeight : " + BoxHeight); file.WriteLine("BoxUniformWidth : " + BoxUniformWidth); file.WriteLine("BoxUniformHeight : " + BoxUniformHeight); file.WriteLine("CircleRadius : " + CircleRadius); file.WriteLine("CircleRadiate : " + CircleRadiate); file.WriteLine("LineAxisX : " + LineAxisX); file.WriteLine("LineAxisY : " + LineAxisY); file.WriteLine("LineLength : " + LineLength); file.WriteLine("PointIsPoint : " + PointIsPoint); file.WriteLine("RingRadius : " + RingRadius); file.WriteLine("RingRadiate : " + RingRadiate); file.WriteLine("SprayDirectionX : " + SprayDirectionX); file.WriteLine("SprayDirectionY : " + SprayDirectionY); file.WriteLine("SpraySpread : " + SpraySpread); file.WriteLine("ParametersColorMin : " + ParametersColorMin); file.WriteLine("ParametersMassMin : " + ParametersMassMin); file.WriteLine("ParametersOpacityMin : " + ParametersOpacityMin); file.WriteLine("ParametersQuantityMin : " + ParametersQuantityMin); file.WriteLine("ParametersRotationMin : " + ParametersRotationMin); file.WriteLine("ParametersScaleMin : " + ParametersScaleMin); file.WriteLine("ParametersSpeedMin : " + ParametersSpeedMin); file.WriteLine("ParametersMassMax : " + ParametersMassMax); file.WriteLine("ParametersOpacityMax : " + ParametersOpacityMax); file.WriteLine("ParametersQuantityMax : " + ParametersQuantityMax); file.WriteLine("ParametersRotationMax : " + ParametersRotationMax); file.WriteLine("ParametersScaleMax : " + ParametersScaleMax); file.WriteLine("ParametersSpeedMax : " + ParametersSpeedMax); file.WriteLine("CircleContainerModifierInside : " + CircleContainerModifierInside); file.WriteLine("CircleContainerModifierRadius : " + CircleContainerModifierRadius); file.WriteLine("CircleContainerModifierRestitutionCoefficient : " + CircleContainerModifierRestitutionCoefficient); file.WriteLine("RectangleContainerModifierWidth : " + RectangleContainerModifierWidth); file.WriteLine("RectangleContainerModifierHeight : " + RectangleContainerModifierHeight); file.WriteLine("RectangleContainerModifierRestitutionCoefficient : " + RectangleContainerModifierRestitutionCoefficient); file.WriteLine("RectangleLoopContainerModifierWidth : " + RectangleLoopContainerModifierWidth); file.WriteLine("RectangleLoopContainerModifierHeight : " + RectangleLoopContainerModifierHeight); file.WriteLine("ModifiersInterpolatorsSelectedName : " + ModifiersInterpolatorsSelectedName); file.WriteLine("AgeModifierColorInterpolatorStartValue : " + AgeModifierColorInterpolatorStartValue); file.WriteLine("AgeModifierColorInterpolatorEndValue : " + AgeModifierColorInterpolatorEndValue); file.WriteLine("AgeModifierHueInterpolatorStartValue : " + AgeModifierHueInterpolatorStartValue); file.WriteLine("AgeModifierHueInterpolatorEndValue : " + AgeModifierHueInterpolatorEndValue); file.WriteLine("AgeModifierOpacityInterpolatorStartValue : " + AgeModifierOpacityInterpolatorStartValue); file.WriteLine("AgeModifierOpacityInterpolatorEndValue : " + AgeModifierOpacityInterpolatorEndValue); file.WriteLine("AgeModifierRotationInterpolatorStartValue : " + AgeModifierRotationInterpolatorStartValue); file.WriteLine("AgeModifierRotationInterpolatorEndValue : " + AgeModifierRotationInterpolatorEndValue); file.WriteLine("AgeModifierScaleInterpolatorStartValueX : " + AgeModifierScaleInterpolatorStartValueX); file.WriteLine("AgeModifierScaleInterpolatorStartValueY : " + AgeModifierScaleInterpolatorStartValueY); file.WriteLine("AgeModifierScaleInterpolatorEndValueX : " + AgeModifierScaleInterpolatorEndValueX); file.WriteLine("AgeModifierScaleInterpolatorEndValueY : " + AgeModifierScaleInterpolatorEndValueY); file.WriteLine("VelocityModifiersInterpolatorsSelectedName : " + VelocityModifiersInterpolatorsSelectedName); file.WriteLine("VelocityModifierColorInterpolatorStartValue : " + VelocityModifierColorInterpolatorStartValue); file.WriteLine("VelocityModifierColorInterpolatorEndValue : " + VelocityModifierColorInterpolatorEndValue); file.WriteLine("VelocityModifierHueInterpolatorStartValue : " + VelocityModifierHueInterpolatorStartValue); file.WriteLine("VelocityModifierHueInterpolatorEndValue : " + VelocityModifierHueInterpolatorEndValue); file.WriteLine("VelocityModifierOpacityInterpolatorStartValue : " + VelocityModifierOpacityInterpolatorStartValue); file.WriteLine("VelocityModifierOpacityInterpolatorEndValue : " + VelocityModifierOpacityInterpolatorEndValue); file.WriteLine("VelocityModifierRotationInterpolatorStartValue : " + VelocityModifierRotationInterpolatorStartValue); file.WriteLine("VelocityModifierRotationInterpolatorEndValue : " + VelocityModifierRotationInterpolatorEndValue); file.WriteLine("VelocityModifierScaleInterpolatorStartValueX : " + VelocityModifierScaleInterpolatorStartValueX); file.WriteLine("VelocityModifierScaleInterpolatorStartValueY : " + VelocityModifierScaleInterpolatorStartValueY); file.WriteLine("VelocityModifierScaleInterpolatorEndValueX : " + VelocityModifierScaleInterpolatorEndValueX); file.WriteLine("VelocityModifierScaleInterpolatorEndValueY : " + VelocityModifierScaleInterpolatorEndValueY); file.WriteLine("DragModifierDragCoefficient : " + DragModifierDragCoefficient); file.WriteLine("DragModifierDensity : " + DragModifierDensity); file.WriteLine("IsLinearGravityModifierSelected : " + IsLinearGravityModifierSelected.ToString()); file.WriteLine("LinearGravityModifierDirectionX : " + LinearGravityModifierDirectionX); file.WriteLine("LinearGravityModifierDirectionY : " + LinearGravityModifierDirectionY); file.WriteLine("LinearGravityModifierStrength : " + LinearGravityModifierStrength); file.WriteLine("LinearGravityModifierControlSizeBuffer : " + LinearGravityModifierControlSizeBuffer); file.WriteLine("LinearGravityModifierControlDuration : " + LinearGravityModifierControlDuration); file.WriteLine("IsOpacityFastFadeModifierSelected : " + IsOpacityFastFadeModifierSelected.ToString()); file.WriteLine("OpacityFastFadeModifierControlSizeBuffer : " + OpacityFastFadeModifierControlSizeBuffer); file.WriteLine("OpacityFastFadeModifierControlDuration : " + OpacityFastFadeModifierControlDuration); file.WriteLine("IsRotationModifierRotationRate : " + IsRotationModifierRotationRate.ToString()); file.WriteLine("RotationModifierRotationRate : " + RotationModifierRotationRate); file.WriteLine("VelocityColorModifierVelocityColor : " + VelocityColorModifierVelocityColor); file.WriteLine("VelocityColorModifierStationaryColor : " + VelocityColorModifierStationaryColor); file.WriteLine("VelocityColorModifierVelocityThreshold : " + VelocityColorModifierVelocityThreshold); file.WriteLine("IsVelocityModifierInterpolatorSelected : " + IsVelocityModifierInterpolatorSelected); file.WriteLine("VelocityModifiersInterpolatorsSelectedName : " + VelocityModifiersInterpolatorsSelectedName); file.WriteLine("VelocityModifierColorInterpolatorStartValue : " + VelocityModifierColorInterpolatorStartValue); file.WriteLine("VelocityModifierColorInterpolatorEndValue : " + VelocityModifierColorInterpolatorEndValue); file.WriteLine("VelocityModifierHueInterpolatorStartValue : " + VelocityModifierHueInterpolatorStartValue); file.WriteLine("VelocityModifierHueInterpolatorEndValue : " + VelocityModifierHueInterpolatorEndValue); file.WriteLine("VelocityModifierOpacityInterpolatorStartValue : " + VelocityModifierOpacityInterpolatorStartValue); file.WriteLine("VelocityModifierOpacityInterpolatorEndValue : " + VelocityModifierOpacityInterpolatorEndValue); file.WriteLine("VelocityModifierRotationInterpolatorStartValue : " + VelocityModifierRotationInterpolatorStartValue); file.WriteLine("VelocityModifierRotationInterpolatorEndValue : " + VelocityModifierRotationInterpolatorEndValue); file.WriteLine("VelocityModifierScaleInterpolatorStartValueX : " + VelocityModifierScaleInterpolatorStartValueX); file.WriteLine("VelocityModifierScaleInterpolatorStartValueY : " + VelocityModifierScaleInterpolatorStartValueY); file.WriteLine("VelocityModifierScaleInterpolatorEndValueX : " + VelocityModifierScaleInterpolatorEndValueX); file.WriteLine("VelocityModifierScaleInterpolatorEndValueY : " + VelocityModifierScaleInterpolatorEndValueY); file.WriteLine("VelocityModifierVelocityThreshold : " + VelocityModifierVelocityThreshold); file.WriteLine("VortexModifierMass : " + VortexModifierMass); file.WriteLine("VortexModifierMaxSpeed : " + VortexModifierMaxSpeed); file.WriteLine("VortexModifierPositionX : " + VortexModifierPositionX); file.WriteLine("VortexModifierPositionY : " + VortexModifierPositionY); file.WriteLine("TextBoxTextureRegionDefinitions : " + TextBoxTextureRegionDefinitions); file.WriteLine("TextBoxCapacityDefinitions : " + TextBoxCapacityDefinitions); file.WriteLine("TextBoxLifeSpanDefinitions : " + TextBoxLifeSpanDefinitions); } #region ParticleEmitter ParticleEmitter particleEmitter = new ParticleEmitter("", textureRegion, DefinitionsCapacity, TimeSpan.FromSeconds(lifeSpan), GetProfile(ProfileName)); isEmit = IsEmitterParameters; if (IsEmitterParameters) { particleEmitter.Parameters = new ParticleReleaseParameters(); if (ParametersSpeedMin <= ParametersSpeedMax && ParametersSpeedMax > 0) { particleEmitter.Parameters.Speed = new Range <float>(ParametersSpeedMin, ParametersSpeedMax); } if (ParametersQuantityMin <= ParametersQuantityMax && ParametersQuantityMax > 0) { particleEmitter.Parameters.Quantity = new Range <int>(ParametersQuantityMin, ParametersQuantityMax); } if (ParametersRotationMin <= ParametersRotationMax && ParametersRotationMax > 0) { particleEmitter.Parameters.Rotation = new Range <float>(ParametersRotationMin, ParametersRotationMax); } if (ParametersScaleMin <= ParametersScaleMax && ParametersScaleMax > 0) { particleEmitter.Parameters.Scale = new Range <float>(ParametersScaleMin, ParametersScaleMax); } if (ParametersOpacityMin <= ParametersOpacityMax && ParametersOpacityMax > 0) { particleEmitter.Parameters.Opacity = new Range <float>(ParametersOpacityMin, ParametersOpacityMax); } if (ParametersMassMin <= ParametersMassMax && ParametersMassMax > 0) { particleEmitter.Parameters.Mass = new Range <float>(ParametersMassMin, ParametersMassMax); } if (ParametersColorMin.R > 0 || ParametersColorMin.G > 0 || ParametersColorMin.B > 0) { particleEmitter.Parameters.Color = HslColor.FromRgb(ParametersColorMin); } } #endregion #region Modifiers Containers if (IsContainerModifierSelected) { if (ContainerModifierSelectedName == "CircleContainerModifier") { CircleContainerModifier circleContainerModifier = new CircleContainerModifier(); circleContainerModifier.Inside = CircleContainerModifierInside; circleContainerModifier.Radius = CircleContainerModifierRadius; circleContainerModifier.RestitutionCoefficient = CircleContainerModifierRestitutionCoefficient; particleEmitter.Modifiers.Add(circleContainerModifier); } if (ContainerModifierSelectedName == "RectangleContainerModifier") { RectangleContainerModifier rectangleContainerModifier = new RectangleContainerModifier(); rectangleContainerModifier.Width = RectangleContainerModifierWidth; rectangleContainerModifier.Height = RectangleContainerModifierHeight; rectangleContainerModifier.RestitutionCoefficient = RectangleContainerModifierRestitutionCoefficient; particleEmitter.Modifiers.Add(rectangleContainerModifier); } if (ContainerModifierSelectedName == "RectangleLoopContainerModifier") { RectangleLoopContainerModifier rectangleLoopContainerModifier = new RectangleLoopContainerModifier(); rectangleLoopContainerModifier.Width = RectangleLoopContainerModifierWidth; rectangleLoopContainerModifier.Height = RectangleLoopContainerModifierHeight; particleEmitter.Modifiers.Add(rectangleLoopContainerModifier); } } #endregion #region AgeModifier Interpolator AgeModifier ageModifierColor = new AgeModifier(); AgeModifier ageModifierHue = new AgeModifier(); AgeModifier ageModifierOpacity = new AgeModifier(); AgeModifier ageModifierRotation = new AgeModifier(); AgeModifier ageModifierScale = new AgeModifier(); if (ModifiersInterpolatorsSelectedName == "ColorInterpolator") { ColorInterpolator ageModifiercolorInterpolator = new ColorInterpolator(); ageModifiercolorInterpolator.StartValue = HslColor.FromRgb(AgeModifierColorInterpolatorStartValue); ageModifierColor.Interpolators.Add(ageModifiercolorInterpolator); } else if (ModifiersInterpolatorsSelectedName == "HueInterpolator") { HueInterpolator ageModifierhueInterpolator = new HueInterpolator(); ageModifierhueInterpolator.StartValue = AgeModifierHueInterpolatorStartValue; ageModifierhueInterpolator.EndValue = AgeModifierHueInterpolatorEndValue; ageModifierHue.Interpolators.Add(ageModifierhueInterpolator); } else if (ModifiersInterpolatorsSelectedName == "OpacityInterpolator") { OpacityInterpolator ageModifierOpacityInterpolator = new OpacityInterpolator(); ageModifierOpacityInterpolator.StartValue = AgeModifierOpacityInterpolatorStartValue; ageModifierOpacityInterpolator.EndValue = AgeModifierOpacityInterpolatorEndValue; ageModifierOpacity.Interpolators.Add(ageModifierOpacityInterpolator); } else if (ModifiersInterpolatorsSelectedName == "RotationInterpolator") { RotationInterpolator ageModifierRotationInterpolator = new RotationInterpolator(); ageModifierRotationInterpolator.StartValue = AgeModifierRotationInterpolatorStartValue; ageModifierRotationInterpolator.EndValue = AgeModifierRotationInterpolatorEndValue; ageModifierRotation.Interpolators.Add(ageModifierRotationInterpolator); } else if (ModifiersInterpolatorsSelectedName == "ScaleInterpolator") { ScaleInterpolator ageModifierScaleInterpolator = new ScaleInterpolator(); ageModifierScaleInterpolator.StartValue = new Vector2(AgeModifierScaleInterpolatorStartValueX, AgeModifierScaleInterpolatorStartValueY); ageModifierScaleInterpolator.EndValue = new Vector2(AgeModifierScaleInterpolatorEndValueX, AgeModifierScaleInterpolatorEndValueY); ageModifierScale.Interpolators.Add(ageModifierScaleInterpolator); } particleEmitter.Modifiers.Add(ageModifierColor); particleEmitter.Modifiers.Add(ageModifierHue); particleEmitter.Modifiers.Add(ageModifierOpacity); particleEmitter.Modifiers.Add(ageModifierRotation); particleEmitter.Modifiers.Add(ageModifierScale); #endregion #region DragModifier Interpolator if (IsDragModifierSelected && DragModifierDensity > 0f && DragModifierDragCoefficient > 0f) { DragModifier dragModifier = new DragModifier(); dragModifier.Density = DragModifierDensity; dragModifier.DragCoefficient = DragModifierDragCoefficient; particleEmitter.Modifiers.Add(dragModifier); } #endregion #region LinearGravityModifier Interpolator if (IsLinearGravityModifierSelected) { LinearGravityModifier linearGravityModifier = new LinearGravityModifier(); linearGravityModifier.Direction = new Vector2(LinearGravityModifierDirectionX, LinearGravityModifierDirectionY); linearGravityModifier.Strength = LinearGravityModifierStrength; if (LinearGravityModifierControlSizeBuffer > 0 && LinearGravityModifierControlDuration > 0) { ParticleBuffer particle1 = new ParticleBuffer(LinearGravityModifierControlSizeBuffer); linearGravityModifier.Update(LinearGravityModifierControlDuration, particle1.Iterator); } particleEmitter.Modifiers.Add(linearGravityModifier); } #endregion #region OpacityFastFadeModifier Interpolator if (IsOpacityFastFadeModifierSelected) { OpacityFastFadeModifier opacityFastFadeModifier = new OpacityFastFadeModifier(); if (OpacityFastFadeModifierControlSizeBuffer > 0 && OpacityFastFadeModifierControlDuration > 0) { ParticleBuffer particle1 = new ParticleBuffer(OpacityFastFadeModifierControlSizeBuffer); opacityFastFadeModifier.Update(OpacityFastFadeModifierControlDuration, particle1.Iterator); } particleEmitter.Modifiers.Add(opacityFastFadeModifier); } #endregion #region RotationModifier Interpolator if (IsRotationModifierRotationRate) { RotationModifier rotationModifier = new RotationModifier(); rotationModifier.RotationRate = RotationModifierRotationRate; particleEmitter.Modifiers.Add(rotationModifier); } #endregion #region VelocityColorModifier Interpolator if (IsVelocityColorModifierSelected) { VelocityColorModifier velocityColorModifier = new VelocityColorModifier(); velocityColorModifier.StationaryColor = HslColor.FromRgb(VelocityColorModifierVelocityColor); velocityColorModifier.VelocityColor = HslColor.FromRgb(VelocityColorModifierStationaryColor); velocityColorModifier.VelocityThreshold = VelocityColorModifierVelocityThreshold; particleEmitter.Modifiers.Add(velocityColorModifier); } #endregion #region VelocityModifier Interpolator if (IsVelocityModifierInterpolatorSelected) { VelocityModifier velocityModifierColor = new VelocityModifier(); VelocityModifier velocityModifierHue = new VelocityModifier(); VelocityModifier velocityModifierOpacity = new VelocityModifier(); VelocityModifier velocityModifierRotation = new VelocityModifier(); VelocityModifier velocityModifierScale = new VelocityModifier(); if (VelocityModifiersInterpolatorsSelectedName == "ColorInterpolator") { ColorInterpolator velocityModifiercolorInterpolator = new ColorInterpolator(); velocityModifiercolorInterpolator.StartValue = HslColor.FromRgb(VelocityModifierColorInterpolatorStartValue); velocityModifiercolorInterpolator.EndValue = HslColor.FromRgb(VelocityModifierColorInterpolatorEndValue); velocityModifierColor.Interpolators.Add(velocityModifiercolorInterpolator); } else if (VelocityModifiersInterpolatorsSelectedName == "HueInterpolator") { HueInterpolator velocityModifierhueInterpolator = new HueInterpolator(); velocityModifierhueInterpolator.StartValue = VelocityModifierHueInterpolatorStartValue; velocityModifierhueInterpolator.EndValue = VelocityModifierHueInterpolatorEndValue; velocityModifierHue.Interpolators.Add(velocityModifierhueInterpolator); } else if (VelocityModifiersInterpolatorsSelectedName == "OpacityInterpolator") { OpacityInterpolator velocityModifierOpacityInterpolator = new OpacityInterpolator(); velocityModifierOpacityInterpolator.StartValue = VelocityModifierOpacityInterpolatorStartValue; velocityModifierOpacityInterpolator.EndValue = VelocityModifierOpacityInterpolatorEndValue; velocityModifierOpacity.Interpolators.Add(velocityModifierOpacityInterpolator); } else if (VelocityModifiersInterpolatorsSelectedName == "RotationInterpolator") { RotationInterpolator velocityModifierRotationInterpolator = new RotationInterpolator(); velocityModifierRotationInterpolator.StartValue = VelocityModifierRotationInterpolatorStartValue; velocityModifierRotationInterpolator.EndValue = VelocityModifierRotationInterpolatorEndValue; velocityModifierRotation.Interpolators.Add(velocityModifierRotationInterpolator); } else if (VelocityModifiersInterpolatorsSelectedName == "ScaleInterpolator") { ScaleInterpolator velocityModifierScaleInterpolator = new ScaleInterpolator(); velocityModifierScaleInterpolator.StartValue = new Vector2(VelocityModifierScaleInterpolatorStartValueX, VelocityModifierScaleInterpolatorStartValueY); velocityModifierScaleInterpolator.EndValue = new Vector2(VelocityModifierScaleInterpolatorEndValueX, VelocityModifierScaleInterpolatorEndValueY); velocityModifierScale.Interpolators.Add(velocityModifierScaleInterpolator); } particleEmitter.Modifiers.Add(velocityModifierColor); particleEmitter.Modifiers.Add(velocityModifierHue); particleEmitter.Modifiers.Add(velocityModifierOpacity); particleEmitter.Modifiers.Add(velocityModifierRotation); particleEmitter.Modifiers.Add(velocityModifierScale); } #endregion #region VortexModifier Interpolator if (IsVortexModifierSelected) { VortexModifier vortexModifier = new VortexModifier(); vortexModifier.Mass = VortexModifierMass; vortexModifier.MaxSpeed = VortexModifierMaxSpeed; vortexModifier.Position = new Vector2(VortexModifierPositionX, VortexModifierPositionY); particleEmitter.Modifiers.Add(vortexModifier); } #endregion particle.Emitters.Add(particleEmitter); }