public void updateParticle( Particle p )
 {
     p.Vx = vx;
     p.Vy = vy;
     p.X = p.X + vx;
     p.Y = p.Y + vy;
     p.Time++;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="relative"></param>
 /// <param name="part"></param>
 public override void placeParticle(Emitter relative, Particle part)
 {
     PathGeometry p = PathGeometry;
     Point location, tangent;
     p.GetPointAtFractionLength(particleRandomizer.NextDouble(), out location,out tangent);
     part.X = location.X;
     part.Y = location.Y;
 }
 public void updateParticle( Particle p )
 {
     p.Vx += Ax;
     p.Vy += Ay;
     p.X = p.X + p.Vx;
     p.Y = p.Y + p.Vy;
     p.Image.Opacity = Math.Max((1 - p.Time * 1.0 / p.Lifetime), 0);
     p.Time++;
 }
        public override void launchParticle(Particle part)
        {
            double minTheta = MinAngle * Math.PI / 180.0;
            double maxTheta = MaxAngle * Math.PI / 180.0;
            double minv = MinVelocity;
            double maxv = MaxVelocity;

            double launchAngle = minTheta + (particleRandomizer.NextDouble()
                * (maxTheta - minTheta));
            double launchVelocity = minv + (particleRandomizer.NextDouble()
                * (maxv - minv));

            part.Vx = launchVelocity * Math.Cos(launchAngle);
            part.Vy = launchVelocity * Math.Sin(launchAngle);

            //notify the particle that it has been launched.
            part.launched();
        }
Beispiel #5
0
        public void emit( Particle p )
        {
            ParticleLauncher.placeParticle(this, p);

            p.Lifetime = p.Lifetime;
            p.Time = 0;

            ParticleLauncher.launchParticle( p );
            // p.update(); //Don't update yet

            particles.AddFirst( p );
        }
Beispiel #6
0
 /// <summary>
 /// Clones this particle.
 /// Does not copy ALL data.
 /// Copies necessary information to allow for quick use.
 /// </summary>
 /// <returns>A clone of this Particle.</returns>
 internal Particle clone()
 {
     Particle cloned = new Particle();
     cloned.Lifetime = this.Lifetime;
     cloned.Image.Source = this.Image.Source;
     cloned.PartControl = PartControl;
     return cloned;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="relative"></param>
 /// <param name="p"></param>
 public virtual void placeParticle(Emitter relative, Particle p)
 {
     p.X = relative.X;
     p.Y = relative.Y;
 }