public void UpdateParticles(object sender, DoWorkEventArgs e)
{
for (var i = 0; i < _backGroundParticleCount; i++)// && !IsMainMenu; i++)
{
var random = new Random();
var randomness = new Vector2((float)(random.NextDouble() * 2 - 1), (float)(random.NextDouble() * 2 - 1));
_backgroundParticles[i].Velocity = Vector2.Multiply(_mPhysicsEnvironment.GravityForce, 15) +
Vector2.Multiply(_mPlayer.Velocity, .25f) + _backgroundParticles[i].Randomness;
_backgroundParticles[i].Update();
Vector2 posDiff;
Vector2 shiftValue;
if (!IsMainMenu)
posDiff = (shiftValue = _mPlayer.Position) - _backgroundParticles[i].Position;
else
posDiff = (shiftValue = new Vector2(_mBounds.Center.X,_mBounds.Center.Y)) - _backgroundParticles[i].Position;
if (posDiff.X < -_mBounds.Width || posDiff.Y < -_mBounds.Height ||
posDiff.X > _mBounds.Width || posDiff.Y > _mBounds.Height)
_backgroundParticles[i].Position = posDiff + shiftValue;
}
}