private void SpawnParticle(float lerpLife, Vector2 position) { float _newLife = Particle.GetLerpValueWithVariation(_life.Values, _lifeVariation.Values, lerpLife); float _newQuantity = Particle.GetLerpValueWithVariation(_quantity.Values, _quantityVariation.Values, lerpLife); float _newWidth = Particle.GetLerpValueWithVariation(_width.Values, _widthVariation.Values, lerpLife); float _newHeight; if (_keepAspectRatio == false) { _newHeight = Particle.GetLerpValueWithVariation(_height.Values, _heightVariation.Values, lerpLife); } else { _newHeight = _newWidth; } float _newVelocity = Particle.GetLerpValueWithVariation(_velocity.Values, _velocityVariation.Values, lerpLife); float _newWeight = Particle.GetLerpValueWithVariation(_weight.Values, _weightVariation.Values, lerpLife); float _newSpin = Particle.GetLerpValueWithVariation(_spin.Values, _spinVariation.Values, lerpLife); float _newMotionRandom = Particle.GetLerpValueWithVariation(_motionRandom.Values, _motionRandomVariation.Values, lerpLife); float _newOpacity = Particle.GetLerpValueWithVariation(_opacity.Values, _opacityVariation.Values, lerpLife); float _newEmissionAngle; if (_useEmitterAngle) { _newEmissionAngle = MathHelper.ToRadians((_emitterEmissionAngle + Particle.GetRandomVariationValue(_emitterEmissionRange))); } else { _newEmissionAngle = MathHelper.ToRadians(Particle.GetLerpValueWithVariation(_emissionAngle.Values, _emissionRange.Values, lerpLife)); } float _newRedTint = MathHelper.Clamp(Particle.GetLerpValueWithVariation(_redTint.Values, _redTintVariation.Values, lerpLife), 0, 1); float _newGreenTint = MathHelper.Clamp(Particle.GetLerpValueWithVariation(_greenTint.Values, _greenTintVariation.Values, lerpLife), 0, 1); float _newBlueTint = MathHelper.Clamp(Particle.GetLerpValueWithVariation(_blueTint.Values, _blueTintVariation.Values, lerpLife), 0, 1); float _rotation; if (_particleOrientationType == ParticleOrientationType.Random) { _rotation = Randomizer.AngleInDegrees(); } else { _rotation = _fixedParticleOrientationAngle; } Particle _newParticle; // if no more place, add a new particle if (_freeParticles.Count == 0) { _newParticle = new Particle(); _particles.Add(_newParticle); } //else use a free slot else { _newParticle = _freeParticles.Dequeue(); } int tile = _tileDefault; if (TileUseRandom == true) { int tileTotal = TileRows * TileCols - TileTotalOffset; tile = Randomizer.Integer(0, tileTotal - 1); } // change the settings _newParticle.ModifiyParticle(this, _material, tile, _keepAspectRatio, _particleOrientationType, _newLife, _newWidth, _newHeight, _newVelocity, _newWeight, _newSpin, _newMotionRandom, _newEmissionAngle, position, _rotation, _newRedTint, _newGreenTint, _newBlueTint, _newOpacity, _texturePivot, true, overLifeSettings); // activate it _newParticle.IsActive = true; }