ExplosionSmokeParticleSystem.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // ExplosionSmokeParticleSystem.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. #region Using Statements
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Text;
  13. using Microsoft.Xna.Framework;
  14. using Microsoft.Xna.Framework.Audio;
  15. using Microsoft.Xna.Framework.GamerServices;
  16. using Microsoft.Xna.Framework.Graphics;
  17. using Microsoft.Xna.Framework.Input;
  18. using Microsoft.Xna.Framework.Storage;
  19. using Microsoft.Xna.Framework.Content;
  20. using Microsoft.Xna.Framework.Media;
  21. #endregion
  22. namespace ParticleSample
  23. {
  24. /// <summary>
  25. /// ExplosionSmokeParticleSystem is a specialization of ParticleSystem which
  26. /// creates a circular pattern of smoke. It should be combined with
  27. /// ExplosionParticleSystem for best effect.
  28. /// </summary>
  29. public class ExplosionSmokeParticleSystem : ParticleSystem
  30. {
  31. public ExplosionSmokeParticleSystem(ParticleSampleGame game, int howManyEffects)
  32. : base(game, howManyEffects)
  33. {
  34. }
  35. /// <summary>
  36. /// Set up the constants that will give this particle system its behavior and
  37. /// properties.
  38. /// </summary>
  39. protected override void InitializeConstants()
  40. {
  41. textureFilename = "smoke";
  42. // less initial speed than the explosion itself
  43. minInitialSpeed = 20;
  44. maxInitialSpeed = 200;
  45. // acceleration is negative, so particles will accelerate away from the
  46. // initial velocity. this will make them slow down, as if from wind
  47. // resistance. we want the smoke to linger a bit and feel wispy, though,
  48. // so we don't stop them completely like we do ExplosionParticleSystem
  49. // particles.
  50. minAcceleration = -10;
  51. maxAcceleration = -50;
  52. // explosion smoke lasts for longer than the explosion itself, but not
  53. // as long as the plumes do.
  54. minLifetime = 1.0f;
  55. maxLifetime = 2.5f;
  56. minScale = 1.0f;
  57. maxScale = 2.0f;
  58. minNumParticles = 10;
  59. maxNumParticles = 20;
  60. minRotationSpeed = -MathHelper.PiOver4;
  61. maxRotationSpeed = MathHelper.PiOver4;
  62. spriteBlendMode = BlendState.AlphaBlend;
  63. DrawOrder = AlphaBlendDrawOrder;
  64. }
  65. }
  66. }