ExplosionParticleSystem.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // ExplosionParticleSystem.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 Microsoft.Xna.Framework;
  12. using Microsoft.Xna.Framework.Content;
  13. using Microsoft.Xna.Framework.Graphics;
  14. #endregion
  15. namespace Particle3DSample
  16. {
  17. /// <summary>
  18. /// Custom particle system for creating the fiery part of the explosions.
  19. /// </summary>
  20. class ExplosionParticleSystem : ParticleSystem
  21. {
  22. public ExplosionParticleSystem(Game game, ContentManager content)
  23. : base(game, content)
  24. { }
  25. protected override void InitializeSettings(ParticleSettings settings)
  26. {
  27. settings.TextureName = "explosion";
  28. settings.MaxParticles = 100;
  29. settings.Duration = TimeSpan.FromSeconds(2);
  30. settings.DurationRandomness = 1;
  31. settings.MinHorizontalVelocity = 20;
  32. settings.MaxHorizontalVelocity = 30;
  33. settings.MinVerticalVelocity = -20;
  34. settings.MaxVerticalVelocity = 20;
  35. settings.EndVelocity = 0;
  36. settings.MinColor = Color.DarkGray;
  37. settings.MaxColor = Color.Gray;
  38. settings.MinRotateSpeed = -1;
  39. settings.MaxRotateSpeed = 1;
  40. settings.MinStartSize = 7;
  41. settings.MaxStartSize = 7;
  42. settings.MinEndSize = 70;
  43. settings.MaxEndSize = 140;
  44. // Use additive blending.
  45. settings.BlendState = BlendState.Additive;
  46. }
  47. }
  48. }