C# Класс Cyclyc.Framework.ParticleSystem

ParticleSystem is an abstract class that provides the basic functionality to create a particle effect. Different subclasses will have different effects, such as fire, explosions, and plumes of smoke. To use these subclasses, simply call AddParticles, and pass in where the particles should exist
Наследование: Microsoft.Xna.Framework.DrawableGameComponent
Показать файл Открыть проект

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

Свойство Тип Описание
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

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

Метод Описание
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 ( GameTime gameTime ) : void

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 ( GameTime gameTime ) : void

overriden from DrawableGameComponent, Update will update all of the active particles.

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

Метод Описание
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

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

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

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.
public AddParticles ( Vector2 where ) : void
where Vector2 where the particle effect should be created
Результат void

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

overriden from DrawableGameComponent, Draw will use ParticleSampleGame's sprite batch to render all of the active particles.
public Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
Результат void

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

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.
public Initialize ( ) : void
Результат void

InitializeConstants() защищенный абстрактный Метод

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.
protected abstract InitializeConstants ( ) : void
Результат void

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

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.
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 ///
Результат void

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

Override the base class LoadContent to load the texture. once it's loaded, calculate the origin.
protected LoadContent ( ) : void
Результат void

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

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.
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.
Результат System

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

PickRandomDirection is used by InitializeParticles to decide which direction particles will move. The default implementation is a random vector in a circular pattern.
protected PickRandomAngle ( ) : float
Результат float

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

protected PickRandomDirection ( ) : Vector2
Результат Vector2

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

overriden from DrawableGameComponent, Update will update all of the active particles.
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
Результат void

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

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

protected float maxAcceleration
Результат float

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

protected float maxBlue
Результат float

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

protected float maxGreen
Результат float

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

protected float maxInitialSpeed
Результат float

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

protected float maxLifetime
Результат float

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

protected int maxNumParticles
Результат int

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

protected float maxRed
Результат float

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

protected float maxRotationSpeed
Результат float

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

protected float maxScale
Результат float

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

minAcceleration and maxAcceleration are used to control the acceleration of the particles. The particle's acceleration will be a random number between these two. By default, the direction of acceleration is the same as the direction of the initial velocity.
protected float minAcceleration
Результат float

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

protected float minBlue
Результат float

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

protected float minGreen
Результат float

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

minInitialSpeed and maxInitialSpeed are used to control the initial velocity of the particles. The particle's initial speed will be a random number between these two. The direction is determined by the function PickRandomDirection, which can be overriden.
protected float minInitialSpeed
Результат float

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

minLifetime and maxLifetime are used to control the lifetime. Each particle's lifetime will be a random number between these two. Lifetime is used to determine how long a particle "lasts." Also, in the base implementation of Draw, lifetime is also used to calculate alpha and scale values to avoid particles suddenly "popping" into view
protected float minLifetime
Результат float

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

minNumParticles and maxNumParticles control the number of particles that are added when AddParticles is called. The number of particles will be a random number between minNumParticles and maxNumParticles.
protected int minNumParticles
Результат int

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

protected float minRed
Результат float

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

minRotationSpeed and maxRotationSpeed control the particles' angular velocity: the speed at which particles will rotate. Each particle's rotation speed will be a random number between minRotationSpeed and maxRotationSpeed. Use smaller numbers to make particle systems look calm and wispy, and large numbers for more violent effects.
protected float minRotationSpeed
Результат float

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

to get some additional variance in the appearance of the particles, we give them all random scales. the scale is a value between minScale and maxScale, and is additionally affected by the particle's lifetime to avoid particles "popping" into view.
protected float minScale
Результат float

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

different effects can use different blend modes. fire and explosions work well with additive blending, for example.
protected SpriteBlendMode spriteBlendMode
Результат SpriteBlendMode

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

this controls the texture that the particle system uses. It will be used as an argument to ContentManager.Load.
protected string textureFilename
Результат string