예제 #1
0
        public virtual void Update()
        {
            velocity += acceleration;
            position += velocity;

            acceleration *= 0;
        }
예제 #2
0
        public Firework(double x, double y, int size, Color color)
        {
            firework     = new Particle(x, y, size, color);
            lastPosition = new ParticleVector(x, y);

            isBurntOut = false;;
        }
예제 #3
0
        public Particle(ParticleVector initialPosition, int size, Color color)
        {
            random = new Random();

            position     = new ParticleVector(initialPosition.X, initialPosition.Y);
            velocity     = new ParticleVector(y: random.Next(-12, -8));
            acceleration = new ParticleVector();

            this.size = size;
        }
예제 #4
0
        public Particle(double x, double y, int size, Color color)
        {
            random = new Random();

            position     = new ParticleVector(x, y);
            velocity     = new ParticleVector(0, random.Next(-12, -8));
            acceleration = new ParticleVector(0, 0);

            Color = color;

            this.size = size;
        }
예제 #5
0
        public override void Update()
        {
            ParticleVector gravity;

            gravity = new ParticleVector(y: 0.15);

            firework.ApplyForce(gravity);
            firework.Update();

            if (firework.Velocity.Y >= 0)
            {
                isBurntOut = true;
            }
        }
예제 #6
0
        public ExplosionParticle(Random randomSeed, ParticleVector initialPosition, int size, Color color) : base(initialPosition, size, color)
        {
            double randomX;
            double randomY;

            random = randomSeed;

            position = new ParticleVector(initialPosition.X, initialPosition.Y);

            randomX = Math.Cos(random.NextDouble() * (Math.PI * 2));
            randomY = Math.Sin(random.NextDouble() * (Math.PI * 2));

            velocity  = new ParticleVector(randomX, randomY);
            velocity *= random.Next(1, 6);

            acceleration = new ParticleVector();

            alpha = 255;

            this.color = color;

            this.size = size;
        }
예제 #7
0
 public void ApplyForce(ParticleVector force)
 {
     acceleration += force;
 }