Beispiel #1
0
 /// <summary>
 /// Creates a new pixel particle emitter inside a particle system.
 /// </summary>
 /// <param name="system">The system to add to.</param>
 protected ParticleEmitter(ParticleSystem system)
     : this()
 {
     if (system == null)
     {
         throw new ArgumentNullException("system");
     }
     system.Add(this, true);
 }
Beispiel #2
0
        protected virtual void initExplosion()
        {
            _ptclSystem = new ParticleSystem();
            _ptclEmitter = new ParticleSurfaceEmitter(_explosionColoredSurfaces == null ? _explosionSurfaces : _explosionColoredSurfaces);
            _ptclEmitter.Frequency = 300;
            _ptclEmitter.LifeFullMin = 20;
            _ptclEmitter.LifeFullMax = 40;
            _ptclEmitter.LifeMin = 10;
            _ptclEmitter.LifeMax = 30;
            _ptclEmitter.DirectionMin = -(float)Math.PI;
            _ptclEmitter.DirectionMax = (float)Math.PI;
            _ptclEmitter.SpeedMin = 5;
            _ptclEmitter.SpeedMax = 6;

            _ptclSystem.Add(_ptclEmitter);

            _ptclSystem.Manipulators.Add(new ParticleGravity(0.2f)); // Gravity
            _ptclSystem.Manipulators.Add(new ParticleFriction(0.3f)); // Slow down _ptclSystem
            //_ptclSystem.Manipulators.Add(new ParticleVortex(1f, 200f)); // A particle vortex fixed on the mouse
            _ptclSystem.Manipulators.Add(new ParticleBoundary(new Size(Constants.StageViewWidth, Constants.StageViewHeight))); // fix _ptclSystem on screen.
        }