ExplosionSmokeParticleSystem.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 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 smokey part of the explosions.
  19. /// </summary>
  20. class ExplosionSmokeParticleSystem : ParticleSystem
  21. {
  22. public ExplosionSmokeParticleSystem(Game game, ContentManager content)
  23. : base(game, content)
  24. { }
  25. protected override void InitializeSettings(ParticleSettings settings)
  26. {
  27. settings.TextureName = "smoke";
  28. settings.MaxParticles = 200;
  29. settings.Duration = TimeSpan.FromSeconds(4);
  30. settings.MinHorizontalVelocity = 0;
  31. settings.MaxHorizontalVelocity = 50;
  32. settings.MinVerticalVelocity = -10;
  33. settings.MaxVerticalVelocity = 50;
  34. settings.Gravity = new Vector3(0, -20, 0);
  35. settings.EndVelocity = 0;
  36. settings.MinColor = Color.LightGray;
  37. settings.MaxColor = Color.White;
  38. settings.MinRotateSpeed = -2;
  39. settings.MaxRotateSpeed = 2;
  40. settings.MinStartSize = 7;
  41. settings.MaxStartSize = 7;
  42. settings.MinEndSize = 70;
  43. settings.MaxEndSize = 140;
  44. }
  45. }
  46. }