C# Класс flxSharp.flxSharp.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 FlxParticle objects out at set intervals by setting their positions and velocities accordingly. It is easy to use and relatively efficient, relying on FlxGroup's RECYCLE POWERS.
Наследование: fliXNA_xbox.FlxGroup
Показать файл Открыть проект

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

Свойство Тип Описание
bounce float
frequency float
gravity float
lifespan float
maxParticleSpeed FlxPoint
maxRotation float
minParticleSpeed FlxPoint
minRotation float
on bool
particleClass Object
particleDrag FlxPoint

Защищенные свойства (Protected)

Свойство Тип Описание
_counter uint
_explode bool
_point FlxPoint
_quantity uint
_timer float

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

Метод Описание
FlxEmitter ( float X, float Y, uint size ) : System

Creates a new FlxEmitter object at a specific position. Does NOT automatically generate or attach particles!

at ( FlxObject flxObject ) : void

Change the emitter's midpoint to match the midpoint of a FlxObject.

destroy ( ) : void

Clean up memory.

emitParticle ( ) : void

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

kill ( ) : void

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

makeParticles ( Microsoft.Xna.Framework.Graphics.Texture2D graphics, uint Quantity = 50, uint BakedRotations, bool Multiple = false, float Collide = 0.8f ) : FlxEmitter

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

setRotation ( float Min, float Max ) : void

A more compact way of setting the angular velocity constraints of the emitter.

setSize ( uint Width, uint Height ) : void

A more compact way of setting the width and height of the emitter.

setXSpeed ( float Min, float Max ) : void

A more compact way of setting the X velocity range of the emitter.

setYSpeed ( float Min, float Max ) : void

A more compact way of setting the Y velocity range of the emitter.

start ( bool Explode = true, float Lifespan, float Frequency = 0.1f, uint Quantity ) : void

Call this function to start emitting particles.

update ( ) : void

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

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

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

Creates a new FlxEmitter object at a specific position. Does NOT automatically generate or attach particles!
public FlxEmitter ( float X, float Y, uint size ) : System
X float The X position of the emitter.
Y float The Y position of the emitter.
size uint Optional, specifies a maximum capacity for this emitter.
Результат System

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

Change the emitter's midpoint to match the midpoint of a FlxObject.
public at ( FlxObject flxObject ) : void
flxObject FlxObject The FlxObject that you want to sync up with.
Результат void

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

Clean up memory.
public destroy ( ) : void
Результат void

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

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

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

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

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

This function generates a new array of particle sprites to attach to the emitter.
public makeParticles ( Microsoft.Xna.Framework.Graphics.Texture2D graphics, uint Quantity = 50, uint BakedRotations, bool Multiple = false, float Collide = 0.8f ) : FlxEmitter
graphics Microsoft.Xna.Framework.Graphics.Texture2D Texture for the particles - can be one square or a spritesheet. Set Multiple to true if it is a spritesheet and it will automatically create the particles as long as each frame on the spritesheet is square
Quantity uint The number of particles to generate
BakedRotations uint
Multiple bool Whether or not the Texture contains multiple sprites for particles
Collide float The collidability of the particle, 1 = Full and 0 = None
Результат FlxEmitter

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

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

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

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

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

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

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

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

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

Call this function to start emitting particles.
public start ( bool Explode = true, float Lifespan, float Frequency = 0.1f, uint Quantity ) : void
Explode bool Whether the particles should all burst out at once.
Lifespan float How long each particle lives once emitted. 0 = forever.
Frequency float Ignored if Explode is set to true. Frequency is how often to emit a particle. 0 = never emit, 0.1 = 1 particle every 0.1 seconds, 5 = 1 particle every 5 seconds.
Quantity uint How many particles to launch. 0 = "all of the particles".
Результат void

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

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

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

_counter защищенное свойство

Internal counter for figuring out how many particles to launch.
protected uint _counter
Результат uint

_explode защищенное свойство

Internal helper for the style of particle emission (all at once, or one at a time).
protected bool _explode
Результат bool

_point защищенное свойство

Internal counter for figuring out how many particles to launch.
protected FlxPoint,flxSharp.flxSharp _point
Результат FlxPoint

_quantity защищенное свойство

Internal helper for deciding how many particles to launch.
protected uint _quantity
Результат uint

_timer защищенное свойство

Internal helper for deciding when to launch particles or kill them.
protected float _timer
Результат float

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

How much each particle should bounce. 1 = full bounce, 0 = no bounce.
public float bounce
Результат float

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

How often a particle is emitted (if emitter is started with Explode == false).
public float frequency
Результат float

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

Sets the acceleration.y member of each particle to this value on launch.
public float gravity
Результат float

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

How long each particle lives once it is emitted. Set lifespan to 'zero' for particles to live forever.
public float lifespan
Результат float

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

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

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

The maximum possible angular velocity of a particle. The default value is 360. NOTE: rotating particles are more expensive to draw than non-rotating ones!
public float maxRotation
Результат float

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

The X position of the top left corner of the emitter in world space. Already inherited by FlxObject. The Y position of the top left corner of emitter in world space. Already inherited by FlxObject. The width of the emitter. Particles can be randomly generated from anywhere within this box. Already inherited by FlxObject. The height of the emitter. Particles can be randomly generated from anywhere within this box. Already inherited by FlxObject. The minimum possible velocity of a particle. The default value is (-100,-100).
public FlxPoint,flxSharp.flxSharp minParticleSpeed
Результат FlxPoint

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

The minimum possible angular velocity of a particle. The default value is -360. NOTE: rotating particles are more expensive to draw than non-rotating ones!
public float minRotation
Результат float

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

Determines whether the emitter is currently emitting particles. It is totally safe to directly toggle this.
public bool on
Результат bool

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

Set your own particle class type here. Default is FlxParticle.
public Object particleClass
Результат Object

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

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