public static ParticleState GetRandom(float minVel, float maxVel) { var state = new ParticleState(); state.Velocity = randomNum.NextVector2(minVel, maxVel); //state.Velocity = new Vector2((float)(randomNum.NextDouble() * (maxVel - minVel) + minVel), (float)(randomNum.NextDouble() * (maxVel - minVel) + minVel)); state.Type = ParticleType.None; state.LengthMultiplier = 1; return(state); }
public void Explode() // Draw particle explosion when a brick is cleared { for (int k = 0; k < 60; k++) // Total particle count { float speed = 20f * (1f - 1 / randomNum.NextFloat(1f, 10f)); var state = new ParticleState() { Velocity = randomNum.NextVector2(speed, speed), Type = ParticleType.Brick, LengthMultiplier = 1f }; // Pass in sprite, brick position, and color for particles GameMain.ParticleManager.CreateParticle(lParticle, new Vector2(X, Y), color, 60, 1.5f, state); } }
public void PaddleHit() { PlaySound(gameContent.paddleBounceSound); for (int k = 0; k < 16; k++) { float speed = 18f * (1f - 1 / randomNum.NextFloat(1f, 10f)); var state = new ParticleState() { Velocity = randomNum.NextVector2(speed, speed), Type = ParticleType.PaddleHit, LengthMultiplier = 0.5f }; // Pass in brick position and color for particles GameMain.ParticleManager.CreateParticle(gameContent.lParticle, new Vector2(X, Y), Color.White, 24, 0.5f, state); } }