Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
ParticleEmitter.cs
1using System.Drawing;
2using SkiaSharp;
3
5
92public sealed class ParticleEmitter
93{
95 public PointF Position { get; set; }
96
98 public float EmitRate { get; set; } = 200f;
99
101 public (float Min, float Max) LifeRange { get; set; } = (0.6f, 1.4f);
102
104 public (float Min, float Max) VelocityRangeX { get; set; } = (-120f, 120f);
105
107 public (float Min, float Max) VelocityRangeY { get; set; } = (-300f, -180f);
108
110 public (float Min, float Max) SizeRange { get; set; } = (3f, 7f);
111
115 public SKColor Color { get; set; } = new SKColor(200, 200, 255, 255);
116
121 public SKBlendMode BlendMode { get; set; } = SKBlendMode.Plus;
122
126 public float JitterX { get; set; } = 0f;
127
131 public float JitterY { get; set; } = 0f;
132
138 public float? GravityX { get; set; } = null;
139
145 public float? GravityY { get; set; } = null;
146
151 public SKBitmap? ParticleSprite { get; set; }
152
157 public SKColor? Tint { get; set; }
158
163 public float? MaxVelocity { get; set; }
164
169
174 public float RingInnerRadius01 { get; set; } = 0.85f;
175
180 public float GaussianStdDev01 { get; set; } = 0.33f;
181
183 public ParticleSpawnHandler? OnSpawn { get; set; }
184
186 public Action<ParticleEmitter, float>? OnUpdate { get; set; }
187
188 // Internal accumulator to handle fractional emit per frame.
189 internal float _accumulator;
190}
Configures how particles are spawned over time at a given location.
SKColor? Tint
Optional per-emitter tint. If set, it overrides the particle system's GlobalColorTint for particles s...
SKColor Color
Base color. Alpha will be modulated by lifetime fade. You can randomize in OnSpawn if desired.
float EmitRate
Particles per second to spawn (fractional allowed).
float JitterX
Gets or sets the horizontal jitter value for spawning particles, which represents a random offset app...
float? GravityY
Gets or sets the vertical component of the gravity vector in pixels per second squared (px/s²)....
float RingInnerRadius01
For Ring distribution: inner radius as a fraction of the outer radius [0..1]. 0 = filled disk,...
ParticleSpawnDistribution SpawnDistribution
Controls the random spawn distribution used by JitterX/JitterY.
SKBlendMode BlendMode
Blend mode used when rendering particles from this emitter. Defaults to SKBlendMode....
SKBitmap? ParticleSprite
Optional sprite used for particles spawned by this emitter. If null, the particle surface’s default s...
PointF Position
RenderHost / adapter pixel position where particles originate.
float? MaxVelocity
Optional per-emitter maximum speed in px/s. If set, particle velocity will be clamped to this magnitu...
ParticleSpawnHandler? OnSpawn
Optional per-particle customization hook (e.g., perlin drift, hue jitter).
float Min
Lifetime range in seconds (min, max).
float GaussianStdDev01
For Gaussian distribution: standard deviation as a fraction of outer radius. Typical values: 0....
float? GravityX
Gets or sets the horizontal component of the gravity vector in pixels per second squared (px/s²)....
Action< ParticleEmitter, float >? OnUpdate
Optional per-frame callback to tweak emitter (e.g., move with an object).
float JitterY
Gets or sets the vertical jitter value for spawning particles, which represents a random offset appli...
delegate void ParticleSpawnHandler(ref Particle particle)
Delegate type for customizing a particle immediately after it is spawned.
ParticleSpawnDistribution
Defines the spatial distribution pattern used when spawning particles within an emitter.