ParticleReleaseParameters.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // Copyright (c) Craftwork Games. All rights reserved.
  2. // Licensed under the MIT license.
  3. // See LICENSE file in the project root for full license information.
  4. using System;
  5. using Microsoft.Xna.Framework;
  6. namespace MonoGame.Extended.Particles.Data;
  7. /// <summary>
  8. /// Defines the parameters used when releasing particles from an emitter.
  9. /// </summary>
  10. /// <remarks>
  11. /// This class encapsulates all the configurable properties that control how particles are initialized when they are
  12. /// created by the particle system. Each property can be set as either a constant value or a random range.
  13. /// </remarks>
  14. public class ParticleReleaseParameters
  15. {
  16. /// <summary>
  17. /// Gets or sets the number of particles to release in a single emission.
  18. /// </summary>
  19. /// <remarks>
  20. /// Defaults to a random value between 5 and 100 particles per emission.
  21. /// </remarks>
  22. public ParticleInt32Parameter Quantity = new ParticleInt32Parameter(5, 100);
  23. /// <summary>
  24. /// Gets or sets the initial speed of particles when released.
  25. /// </summary>
  26. /// <remarks>
  27. /// Defaults to a random value between 50.0 and 100.0 units per second.
  28. /// </remarks>
  29. public ParticleFloatParameter Speed = new ParticleFloatParameter(50.0f, 100.0f);
  30. /// <summary>
  31. /// Gets or sets the initial color of particles when released.
  32. /// </summary>
  33. /// <remarks>
  34. /// Defaults to white (1.0f, 1.0f, 1.0f).
  35. /// </remarks>
  36. public ParticleColorParameter Color = new ParticleColorParameter(new Vector3(1.0f, 1.0f, 1.0f));
  37. /// <summary>
  38. /// Gets or sets the initial opacity of particles when released.
  39. /// </summary>
  40. /// <remarks>
  41. /// Defaults to a random value between 0.0 (transparent) and 1.0 (opaque).
  42. /// </remarks>
  43. public ParticleFloatParameter Opacity = new ParticleFloatParameter(0.0f, 1.0f);
  44. /// <summary>
  45. /// Gets or sets the initial scale of particles when released.
  46. /// </summary>
  47. /// <remarks>
  48. /// Defaults to a random value between 0.0 (half scale) and 1.0 (full scale)
  49. /// </remarks>
  50. public ParticleVector2Parameter Scale = new ParticleVector2Parameter(new Vector2(0.5f, 0.5f), new Vector2(1.0f, 1.0f));
  51. /// <summary>
  52. /// Gets or sets the initial rotation (in radians) of particles when released.
  53. /// </summary>
  54. /// <remarks>
  55. /// Defaults to a random value between -π and π radians (a full 360° range).
  56. /// </remarks>
  57. public ParticleFloatParameter Rotation = new ParticleFloatParameter(-MathF.PI, MathF.PI);
  58. /// <summary>
  59. /// Gets or sets the mass of particles when released.
  60. /// </summary>
  61. /// <remarks>
  62. /// Defaults to a constant value of 1.0.
  63. /// </remarks>
  64. public ParticleFloatParameter Mass = new ParticleFloatParameter(1.0f);
  65. /// <summary>
  66. /// Initializes a new instance of the <see cref="ParticleReleaseParameters"/> class with default values.
  67. /// </summary>
  68. /// <remarks>
  69. /// Default values for properties:
  70. /// <para>
  71. /// <list type="table">
  72. /// <listheader>
  73. /// <term>Property</term>
  74. /// <description>Default Value</description>
  75. /// </listheader>
  76. /// <item>
  77. /// <term>Quantity</term>
  78. /// <description>Random: 5-100 particles</description>
  79. /// </item>
  80. /// <item>
  81. /// <term>Speed</term>
  82. /// <description>Random: 50.0-100.0 units/second</description>
  83. /// </item>
  84. /// <item>
  85. /// <term>Color</term>
  86. /// <description>Constant: White (1.0, 1.0, 1.0)</description>
  87. /// </item>
  88. /// <item>
  89. /// <term>Opacity</term>
  90. /// <description>Random: 0.0-1.0</description>
  91. /// </item>
  92. /// <item>
  93. /// <term>Scale</term>
  94. /// <description>Random: 0.5-1.0</description>
  95. /// </item>
  96. /// <item>
  97. /// <term>Rotation</term>
  98. /// <description>Random: -π to π radians</description>
  99. /// </item>
  100. /// <item>
  101. /// <term>Mass</term>
  102. /// <description>Constant: 1.0</description>
  103. /// </item>
  104. /// </list>
  105. /// </para>
  106. /// </remarks>
  107. public ParticleReleaseParameters() { }
  108. }