C# Класс XnaFlixel.FlxEmitter

FlxEmitter is a lightweight particle emitter. It can be used for one-time explosions or for continuous fx like rain and fire. FlxEmitter is not optimized or anything; all it does is launch FlxSprite objects out at set intervals by setting their positions and velocities accordingly. It is easy to use and relatively efficient, since it automatically redelays its sprites and/or kills them once they've been launched.
Наследование: FlxGroup
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
delay float
justEmitted bool
maxParticleSpeed Vector2
minParticleSpeed Vector2
particleDrag Vector2

Открытые методы

Метод Описание
At ( FlxObject Object ) : void

Change the emitter's position to the origin of a FlxObject. @param Object The FlxObject that needs to spew particles.

CreateSprites ( Microsoft.Xna.Framework.Graphics.Texture2D graphics, int quantity ) : FlxEmitter

This function generates a new array of sprites to attach to the emitter.

CreateSprites ( Microsoft.Xna.Framework.Graphics.Texture2D graphics, int quantity, bool Multiple ) : FlxEmitter

This function generates a new array of sprites to attach to the emitter.

CreateSprites ( Microsoft.Xna.Framework.Graphics.Texture2D graphics, int quantity, bool Multiple, float Collide, float Bounce ) : FlxEmitter

This function generates a new array of sprites to attach to the emitter.

EmitParticle ( ) : void

This function can be used both internally and externally to emit the next particle.

FlxEmitter ( ) : System.Collections.Generic

Creates a new FlxEmitter object at a specific position. Does not automatically generate or attach particles! @param X The X position of the emitter. @param Y The Y position of the emitter.

FlxEmitter ( int x, int y ) : System.Collections.Generic
Kill ( ) : void

Call this function to turn off all the particles and the emitter.

SetRotation ( ) : void

A more compact way of setting the angular velocity constraints of the emitter. @param Min The minimum value for this range. @param Max The maximum value for this range.

SetRotation ( float Min, float Max ) : void
SetSize ( int Width, int Height ) : void

A more compact way of setting the width and height of the emitter. @param Width The desired width of the emitter (particles are spawned randomly within these dimensions). @param Height The desired height of the emitter.

SetXSpeed ( ) : void

A more compact way of setting the X velocity range of the emitter. @param Min The minimum value for this range. @param Max The maximum value for this range.

SetXSpeed ( float Min, float Max ) : void
SetYSpeed ( ) : void

A more compact way of setting the Y velocity range of the emitter. @param Min The minimum value for this range. @param Max The maximum value for this range.

SetYSpeed ( float Min, float Max ) : void
Start ( ) : void

Call this function to start emitting particles. @param Explode Whether the particles should all burst out at once. @param Delay You can set the delay (or lifespan) here if you want. @param quantity How many particles to launch. Default value is 0, or "all the particles".

Start ( bool Explode, float Delay ) : void
Start ( bool Explode, float Delay, int Quantity ) : void
Stop ( ) : void

Call this function to stop the emitter without killing it. @param Delay How long to wait before killing all the particles. Set to 'zero' to never kill them.

Stop ( float Delay ) : void
Update ( ) : void

Called automatically by the game loop, decides when to launch particles and when to "die".

Защищенные методы

Метод Описание
UpdateMembers ( ) : void

Internal function that actually goes through and updates all the group members. Overridden here to remove the position update code normally used by a FlxGroup.

Приватные методы

Метод Описание
Initialize ( int x, int y ) : void
UpdateEmitter ( ) : void

Internal function that actually performs the emitter update (called by update()).

Описание методов

At() публичный Метод

Change the emitter's position to the origin of a FlxObject. @param Object The FlxObject that needs to spew particles.
public At ( FlxObject Object ) : void
Object FlxObject
Результат void

CreateSprites() публичный Метод

This function generates a new array of sprites to attach to the emitter.
public CreateSprites ( Microsoft.Xna.Framework.Graphics.Texture2D graphics, int quantity ) : FlxEmitter
graphics Microsoft.Xna.Framework.Graphics.Texture2D If you opted to not pre-configure an array of FlxSprite objects, you can simply pass in a particle image or sprite sheet.
quantity int The number of particles to generate when using the "create from image" option.
Результат FlxEmitter

CreateSprites() публичный Метод

This function generates a new array of sprites to attach to the emitter.
public CreateSprites ( Microsoft.Xna.Framework.Graphics.Texture2D graphics, int quantity, bool Multiple ) : FlxEmitter
graphics Microsoft.Xna.Framework.Graphics.Texture2D If you opted to not pre-configure an array of FlxSprite objects, you can simply pass in a particle image or sprite sheet.
quantity int The number of particles to generate when using the "create from image" option.
Multiple bool Whether the image in the graphics param is a single particle or a bunch of particles (if it's a bunch, they need to be square!).
Результат FlxEmitter

CreateSprites() публичный Метод

This function generates a new array of sprites to attach to the emitter.
public CreateSprites ( Microsoft.Xna.Framework.Graphics.Texture2D graphics, int quantity, bool Multiple, float Collide, float Bounce ) : FlxEmitter
graphics Microsoft.Xna.Framework.Graphics.Texture2D If you opted to not pre-configure an array of FlxSprite objects, you can simply pass in a particle image or sprite sheet.
quantity int The number of particles to generate when using the "create from image" option.
Multiple bool Whether the image in the graphics param is a single particle or a bunch of particles (if it's a bunch, they need to be square!).
Collide float Whether the particles should be flagged as not 'dead' (non-colliding particles are higher performance). 0 means no collisions, 0-1 controls scale of particle's bounding box.
Bounce float Whether the particles should bounce after colliding with things. 0 means no bounce, 1 means full reflection.
Результат FlxEmitter

EmitParticle() публичный Метод

This function can be used both internally and externally to emit the next particle.
public EmitParticle ( ) : void
Результат void

FlxEmitter() публичный Метод

Creates a new FlxEmitter object at a specific position. Does not automatically generate or attach particles! @param X The X position of the emitter. @param Y The Y position of the emitter.
public FlxEmitter ( ) : System.Collections.Generic
Результат System.Collections.Generic

FlxEmitter() публичный Метод

public FlxEmitter ( int x, int y ) : System.Collections.Generic
x int
y int
Результат System.Collections.Generic

Kill() публичный Метод

Call this function to turn off all the particles and the emitter.
public Kill ( ) : void
Результат void

SetRotation() публичный Метод

A more compact way of setting the angular velocity constraints of the emitter. @param Min The minimum value for this range. @param Max The maximum value for this range.
public SetRotation ( ) : void
Результат void

SetRotation() публичный Метод

public SetRotation ( float Min, float Max ) : void
Min float
Max float
Результат void

SetSize() публичный Метод

A more compact way of setting the width and height of the emitter. @param Width The desired width of the emitter (particles are spawned randomly within these dimensions). @param Height The desired height of the emitter.
public SetSize ( int Width, int Height ) : void
Width int
Height int
Результат void

SetXSpeed() публичный Метод

A more compact way of setting the X velocity range of the emitter. @param Min The minimum value for this range. @param Max The maximum value for this range.
public SetXSpeed ( ) : void
Результат void

SetXSpeed() публичный Метод

public SetXSpeed ( float Min, float Max ) : void
Min float
Max float
Результат void

SetYSpeed() публичный Метод

A more compact way of setting the Y velocity range of the emitter. @param Min The minimum value for this range. @param Max The maximum value for this range.
public SetYSpeed ( ) : void
Результат void

SetYSpeed() публичный Метод

public SetYSpeed ( float Min, float Max ) : void
Min float
Max float
Результат void

Start() публичный Метод

Call this function to start emitting particles. @param Explode Whether the particles should all burst out at once. @param Delay You can set the delay (or lifespan) here if you want. @param quantity How many particles to launch. Default value is 0, or "all the particles".
public Start ( ) : void
Результат void

Start() публичный Метод

public Start ( bool Explode, float Delay ) : void
Explode bool
Delay float
Результат void

Start() публичный Метод

public Start ( bool Explode, float Delay, int Quantity ) : void
Explode bool
Delay float
Quantity int
Результат void

Stop() публичный Метод

Call this function to stop the emitter without killing it. @param Delay How long to wait before killing all the particles. Set to 'zero' to never kill them.
public Stop ( ) : void
Результат void

Stop() публичный Метод

public Stop ( float Delay ) : void
Delay float
Результат void

Update() публичный Метод

Called automatically by the game loop, decides when to launch particles and when to "die".
public Update ( ) : void
Результат void

UpdateMembers() защищенный Метод

Internal function that actually goes through and updates all the group members. Overridden here to remove the position update code normally used by a FlxGroup.
protected UpdateMembers ( ) : void
Результат void

Описание свойств

delay публичное свойство

This variable has different effects depending on what kind of emission it is. During an explosion, delay controls the lifespan of the particles. During normal emission, delay controls the time between particle launches. NOTE: In older builds, polarity (negative numbers) was used to define emitter behavior. THIS IS NO LONGER THE CASE! FlxEmitter.start() controls that now!
public float delay
Результат float

justEmitted публичное свойство

Checks whether you already fired a particle this frame.
public bool justEmitted
Результат bool

maxParticleSpeed публичное свойство

The maximum possible velocity of a particle. The default value is (100,100).
public Vector2 maxParticleSpeed
Результат Vector2

minParticleSpeed публичное свойство

The minimum possible velocity of a particle. The default value is (-100,-100).
public Vector2 minParticleSpeed
Результат Vector2

particleDrag публичное свойство

The X and Y drag component of particles launched from the emitter.
public Vector2 particleDrag
Результат Vector2