C# Class Drought.Graphics.Particles.ParticleEmitter

Helper for objects that want to leave particles behind them as they move around the world. This emitter implementation solves two related problems: If an object wants to create particles very slowly, less than once per frame, it can be a pain to keep track of which updates ought to create a new particle versus which should not. If an object is moving quickly and is creating many particles per frame, it will look ugly if these particles are all bunched up together. Much better if they can be spread out along a line between where the object is now and where it was on the previous frame. This is particularly important for leaving trails behind fast moving objects such as rockets. This emitter class keeps track of a moving object, remembering its previous position so it can calculate the velocity of the object. It works out the perfect locations for creating particles at any frequency you specify, regardless of whether this is faster or slower than the game update rate.
Afficher le fichier Open project: kiniry-teaching/UCD Class Usage Examples

Méthodes publiques

Méthode Description
ParticleEmitter ( ParticleSystem particleSystem, float particlesPerSecond, Vector3 initialPosition ) : System

Constructs a new particle emitter object.

Update ( GameTime gameTime, Vector3 newPosition ) : void

Updates the emitter, creating the appropriate number of particles in the appropriate positions.

Method Details

ParticleEmitter() public méthode

Constructs a new particle emitter object.
public ParticleEmitter ( ParticleSystem particleSystem, float particlesPerSecond, Vector3 initialPosition ) : System
particleSystem ParticleSystem
particlesPerSecond float
initialPosition Vector3
Résultat System

Update() public méthode

Updates the emitter, creating the appropriate number of particles in the appropriate positions.
public Update ( GameTime gameTime, Vector3 newPosition ) : void
gameTime Microsoft.Xna.Framework.GameTime
newPosition Vector3
Résultat void