Property | Type | Description | |
---|---|---|---|
maxAcceleration | float | ||
maxBlue | float | ||
maxGreen | float | ||
maxInitialSpeed | float | ||
maxLifetime | float | ||
maxNumParticles | int | ||
maxRed | float | ||
maxRotationSpeed | float | ||
maxScale | float | ||
minAcceleration | float | ||
minBlue | float | ||
minGreen | float | ||
minInitialSpeed | float | ||
minLifetime | float | ||
minNumParticles | int | ||
minRed | float | ||
minRotationSpeed | float | ||
minScale | float | ||
spriteBlendMode | SpriteBlendMode | ||
textureFilename | string |
Method | Description | |
---|---|---|
AddParticles ( Vector2 where ) : void |
AddParticles's job is to add an effect somewhere on the screen. If there aren't enough particles in the freeParticles queue, it will use as many as it can. This means that if there not enough particles available, calling AddParticles will have no effect.
|
|
Draw ( |
overriden from DrawableGameComponent, Draw will use ParticleSampleGame's sprite batch to render all of the active particles.
|
|
Initialize ( ) : void |
override the base class's Initialize to do some additional work; we want to call InitializeConstants to let subclasses set the constants that we'll use. also, the particle array and freeParticles queue are set up here.
|
|
Update ( |
overriden from DrawableGameComponent, Update will update all of the active particles.
|
Method | Description | |
---|---|---|
InitializeConstants ( ) : void |
this abstract function must be overriden by subclasses of ParticleSystem. It's here that they should set all the constants marked in the region "constants to be set by subclasses", which give each ParticleSystem its specific flavor.
|
|
InitializeParticle ( Particle p, Vector2 where ) : void |
InitializeParticle randomizes some properties for a particle, then calls initialize on it. It can be overriden by subclasses if they want to modify the way particles are created. For example, SmokePlumeParticleSystem overrides this function make all particles accelerate to the right, simulating wind.
|
|
LoadContent ( ) : void |
Override the base class LoadContent to load the texture. once it's loaded, calculate the origin.
|
|
ParticleSystem ( Game1 game, int howManyEffects ) : System |
Constructs a new ParticleSystem. it is tempting to set the value of howManyEffects very high. However, this value should be set to the minimum possible, because it has a large impact on the amount of memory required, and slows down the Update and Draw functions. |
|
PickRandomAngle ( ) : float |
PickRandomDirection is used by InitializeParticles to decide which direction particles will move. The default implementation is a random vector in a circular pattern.
|
|
PickRandomDirection ( ) : Vector2 |
public AddParticles ( Vector2 where ) : void | ||
where | Vector2 | where the particle effect should be created |
return | void |
public Draw ( |
||
gameTime | ||
return | void |
protected abstract InitializeConstants ( ) : void | ||
return | void |
protected InitializeParticle ( Particle p, Vector2 where ) : void | ||
p | Particle | the particle to initialize |
where | Vector2 | the position on the screen that the particle should be /// |
return | void |
protected ParticleSystem ( Game1 game, int howManyEffects ) : System | ||
game | Game1 | The host for this particle system. The game keeps the /// content manager and sprite batch for us. |
howManyEffects | int | the maximum number of particle effects that /// are expected on screen at once. |
return | System |
public Update ( |
||
gameTime | ||
return | void |
protected SpriteBlendMode spriteBlendMode | ||
return | SpriteBlendMode |