public virtual void Update() { velocity += acceleration; position += velocity; acceleration *= 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;; }
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; }
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; }
public override void Update() { ParticleVector gravity; gravity = new ParticleVector(y: 0.15); firework.ApplyForce(gravity); firework.Update(); if (firework.Velocity.Y >= 0) { isBurntOut = true; } }
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; }
public void ApplyForce(ParticleVector force) { acceleration += force; }