ParticleSettings.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // ParticleSettings.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.Graphics;
  13. #endregion
  14. namespace Particle3DSample
  15. {
  16. /// <summary>
  17. /// Settings class describes all the tweakable options used
  18. /// to control the appearance of a particle system.
  19. /// </summary>
  20. public class ParticleSettings
  21. {
  22. // Name of the texture used by this particle system.
  23. public string TextureName = null;
  24. // Maximum number of particles that can be displayed at one time.
  25. public int MaxParticles = 100;
  26. // How long these particles will last.
  27. public TimeSpan Duration = TimeSpan.FromSeconds(1);
  28. // If greater than zero, some particles will last a shorter time than others.
  29. public float DurationRandomness = 0;
  30. // Controls how much particles are influenced by the velocity of the object
  31. // which created them. You can see this in action with the explosion effect,
  32. // where the flames continue to move in the same direction as the source
  33. // projectile. The projectile trail particles, on the other hand, set this
  34. // value very low so they are less affected by the velocity of the projectile.
  35. public float EmitterVelocitySensitivity = 1;
  36. // Range of values controlling how much X and Z axis velocity to give each
  37. // particle. Values for individual particles are randomly chosen from somewhere
  38. // between these limits.
  39. public float MinHorizontalVelocity = 0;
  40. public float MaxHorizontalVelocity = 0;
  41. // Range of values controlling how much Y axis velocity to give each particle.
  42. // Values for individual particles are randomly chosen from somewhere between
  43. // these limits.
  44. public float MinVerticalVelocity = 0;
  45. public float MaxVerticalVelocity = 0;
  46. // Direction and strength of the gravity effect. Note that this can point in any
  47. // direction, not just down! The fire effect points it upward to make the flames
  48. // rise, and the smoke plume points it sideways to simulate wind.
  49. public Vector3 Gravity = Vector3.Zero;
  50. // Controls how the particle velocity will change over their lifetime. If set
  51. // to 1, particles will keep going at the same speed as when they were created.
  52. // If set to 0, particles will come to a complete stop right before they die.
  53. // Values greater than 1 make the particles speed up over time.
  54. public float EndVelocity = 1;
  55. // Range of values controlling the particle color and alpha. Values for
  56. // individual particles are randomly chosen from somewhere between these limits.
  57. public Color MinColor = Color.White;
  58. public Color MaxColor = Color.White;
  59. // Range of values controlling how fast the particles rotate. Values for
  60. // individual particles are randomly chosen from somewhere between these
  61. // limits. If both these values are set to 0, the particle system will
  62. // automatically switch to an alternative shader technique that does not
  63. // support rotation, and thus requires significantly less GPU power. This
  64. // means if you don't need the rotation effect, you may get a performance
  65. // boost from leaving these values at 0.
  66. public float MinRotateSpeed = 0;
  67. public float MaxRotateSpeed = 0;
  68. // Range of values controlling how big the particles are when first created.
  69. // Values for individual particles are randomly chosen from somewhere between
  70. // these limits.
  71. public float MinStartSize = 100;
  72. public float MaxStartSize = 100;
  73. // Range of values controlling how big particles become at the end of their
  74. // life. Values for individual particles are randomly chosen from somewhere
  75. // between these limits.
  76. public float MinEndSize = 100;
  77. public float MaxEndSize = 100;
  78. // Alpha blending settings.
  79. public BlendState BlendState = BlendState.NonPremultiplied;
  80. }
  81. }