public void WasShot() { hitpoints--; if (hitpoints <= 0) { IsExpired = true; PlayerStatus.AddPoints(5); PlayerStatus.IncreaseMultiplier(); } float hue = (float)((3 * NeonShooterGame.GameTime.TotalGameTime.TotalSeconds) % 6); Color color = ColorUtil.HSVToColor(hue, 0.25f, 1); const int numParticles = 150; float startOffset = rand.NextFloat(0, MathHelper.TwoPi / numParticles); for (int i = 0; i < numParticles; i++) { Vector2 sprayVel = MathUtil.FromPolar(MathHelper.TwoPi * i / numParticles + startOffset, rand.NextFloat(8, 16)); Vector2 pos = Position + 2f * sprayVel; var state = new ParticleState() { Velocity = sprayVel, LengthMultiplier = 1, Type = ParticleType.IgnoreGravity }; NeonShooterGame.ParticleManager.CreateParticle(Art.LineParticle, pos, color, 90, 1.5f, state); } Sound.Explosion.Play(0.5f, rand.NextFloat(-0.2f, 0.2f), 0); }
public void WasShot() { IsExpired = true; PlayerStatus.AddPoints(PointValue); PlayerStatus.IncreaseMultiplier(); float hue1 = rand.NextFloat(0, 6); float hue2 = (hue1 + rand.NextFloat(0, 2)) % 6f; Color color1 = ColorUtil.HSVToColor(hue1, 0.5f, 1); Color color2 = ColorUtil.HSVToColor(hue2, 0.5f, 1); for (int i = 0; i < 120; i++) { float speed = 18f * (1f - 1 / rand.NextFloat(1, 10)); var state = new ParticleState() { Velocity = rand.NextVector2(speed, speed), Type = ParticleType.Enemy, LengthMultiplier = 1 }; Color color = Color.Lerp(color1, color2, rand.NextFloat(0, 1)); NeonShooterGame.ParticleManager.CreateParticle(Art.LineParticle, Position, color, 190, 1.5f, state); } Sound.Explosion.Play(0.5f, rand.NextFloat(-0.2f, 0.2f), 0); }
public void WasShot() { var rand = new Random(); IsExpired = true; PlayerStatus.AddPoints(PointValue); PlayerStatus.IncreaseMultiplier(); var hue1 = rand.NextFloat(0, 6); var hue2 = (hue1 + rand.NextFloat(0, 2)) % 6f; var color1 = ColorUtil.HSVToColor(hue1, 0.5f, 1); var color2 = ColorUtil.HSVToColor(hue2, 0.5f, 1); Sound.Explosion.Play(0.5f, rand.NextFloat(-0.2f, 0.2f), 0); for (var i = 0; i < 120; i++) { float speed = 18f * (1f - 1 / rand.NextFloat(1f, 10f)); var state = new ParticleState(rand.NextVector2(speed, speed), ParticleType.Enemy); var particleColor = Color.Lerp(color1, color2, rand.NextFloat(0, 1)); GameRoot.ParticleManager.CreateParticle(Art.LineParticle, Position, particleColor, 180, new Vector2(0.7f, 0.7f), state); } }
public void WasShot() { IsExpired = true; PlayerStatus.AddPoints(PointValue); PlayerStatus.IncreaseMultiplier(); }