Class ParticleEmitter
Represents a particle emitter as a game element.
Inherited Members
Namespace: Genesis.Core.GameElements
Assembly: Genesis.dll
Syntax
public class ParticleEmitter : GameElement
Constructors
ParticleEmitter(string, Vec3, Vec3, Vec3, Texture)
Initializes a new instance of the ParticleEmitter class with specified parameters.
Declaration
public ParticleEmitter(string name, Vec3 location, Vec3 rotation, Vec3 size, Texture mask)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the particle emitter. |
Vec3 | location | The initial location of the particle emitter. |
Vec3 | rotation | The initial rotation of the particle emitter. |
Vec3 | size | The initial size of the particle emitter. |
Texture | mask |
Properties
EndColor
The end color for the particles
Declaration
public Color EndColor { get; set; }
Property Value
Type | Description |
---|---|
Color |
ParticleDeffinitions
Gets or sets the list of particle definitions managed by the emitter.
Declaration
public List<ParticleDeffinition> ParticleDeffinitions { get; set; }
Property Value
Type | Description |
---|---|
List<ParticleDeffinition> |
ParticleDirection
Gets or sets the primary direction of particle movement.
Declaration
public Vec3 ParticleDirection { get; set; }
Property Value
Type | Description |
---|---|
Vec3 |
ParticleDirection2
Gets or sets the secondary direction of particle movement.
Declaration
public Vec3 ParticleDirection2 { get; set; }
Property Value
Type | Description |
---|---|
Vec3 |
ParticleDistance
Gets or sets the maximum distance a particle can travel before being reset.
Declaration
public float ParticleDistance { get; set; }
Property Value
Type | Description |
---|---|
float |
ParticleMask
Gets or sets the mask for the particles
Declaration
public Texture ParticleMask { get; set; }
Property Value
Type | Description |
---|---|
Texture |
StartColor
The start color for the partciles
Declaration
public Color StartColor { get; set; }
Property Value
Type | Description |
---|---|
Color |
Texture
Gets or sets the texture used for the particles.
Declaration
public Texture Texture { get; set; }
Property Value
Type | Description |
---|---|
Texture |
Methods
CreateParticles(int, Vec3)
Generates particles with default settings, using the provided particle size.
Declaration
public void CreateParticles(int numPartikel, Vec3 particleSize)
Parameters
Type | Name | Description |
---|---|---|
int | numPartikel | The number of particles to create. |
Vec3 | particleSize | The size of each particle. |
CreateParticles(int, Vec3, Vec3, Vec3, Vec3, int, int, float, float, float, float, Color, Color)
Declaration
public void CreateParticles(int numPartikel, Vec3 particleSizeMax, Vec3 particleSizeMin, Vec3 minRotation, Vec3 maxRotation, int minDelay, int maxDelay, float minSpeed, float maxSpeed, float minRotationSpeed, float maxRotationSpeed, Color colorA, Color colorB)
Parameters
Type | Name | Description |
---|---|---|
int | numPartikel | |
Vec3 | particleSizeMax | |
Vec3 | particleSizeMin | |
Vec3 | minRotation | |
Vec3 | maxRotation | |
int | minDelay | |
int | maxDelay | |
float | minSpeed | |
float | maxSpeed | |
float | minRotationSpeed | |
float | maxRotationSpeed | |
Color | colorA | |
Color | colorB |
CreateParticles(int, Vec3, Vec3, Vec3, int, int, float, float, float, float, Color, Color)
Generates particles with custom settings, including particle size, rotation, delay, speed, and rotation speed.
Declaration
public void CreateParticles(int numPartikel, Vec3 particleSize, Vec3 minRotation, Vec3 maxRotation, int minDelay, int maxDelay, float minSpeed, float maxSpeed, float minRotationSpeed, float maxRotationSpeed, Color colorA, Color colorB)
Parameters
Type | Name | Description |
---|---|---|
int | numPartikel | The number of particles to create. |
Vec3 | particleSize | The size of each particle. |
Vec3 | minRotation | The minimum rotation of particles. |
Vec3 | maxRotation | The maximum rotation of particles. |
int | minDelay | The minimum delay before particles become active. |
int | maxDelay | The maximum delay before particles become active. |
float | minSpeed | The minimum speed of particles. |
float | maxSpeed | The maximum speed of particles. |
float | minRotationSpeed | The minimum rotation speed of particles. |
float | maxRotationSpeed | The maximum rotation speed of particles. |
Color | colorA | The minimum color of particles. |
Color | colorB | The maximum color of particles. |
CreateParticles(int, Vec3, Color, Color)
Generates particles with default settings, using the provided particle size and specified colors.
Declaration
public void CreateParticles(int numPartikel, Vec3 particleSize, Color colorA, Color colorB)
Parameters
Type | Name | Description |
---|---|---|
int | numPartikel | The number of particles to create. |
Vec3 | particleSize | The size of each particle. |
Color | colorA | The minimum color of particles. |
Color | colorB | The maximum color of particles. |
GetParticleBuffers()
Generates the buffer for the particles, including vertices, colors, texture coordinates, positions, rotations, and scales.
Declaration
public ParticleBuffers GetParticleBuffers()
Returns
Type | Description |
---|---|
ParticleBuffers | Particle buffers containing vertices, colors, texture coordinates, positions, rotations, and scales. |
OnDestroy(Game)
Called when the particle emitter is being destroyed in the game.
Declaration
public override void OnDestroy(Game game)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The game instance. |
Overrides
OnRender(Game, IRenderDevice)
Renders the particle emitter using the specified render device.
Declaration
public override void OnRender(Game game, IRenderDevice renderDevice)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The game instance. |
IRenderDevice | renderDevice | The render device used for rendering. |
Overrides
ProcessParticle(ParticleDeffinition, long)
Processes the movement and rotation of a particle based on its current state.
Declaration
public void ProcessParticle(ParticleDeffinition particle, long now)
Parameters
Type | Name | Description |
---|---|---|
ParticleDeffinition | particle | The particle definition to be processed. |
long | now | The current time in milliseconds. |