public virtual void Update(GameTime gameTime) { elapsedLife += Stcs.DilateTime(gameTime.ElapsedGameTime); foreach (var modifier in Modifiers) { modifier.Apply(gameTime, this); } }
public virtual void Update(GameTime gameTime) { elapsedLife += Stcs.DilateTime(gameTime.ElapsedGameTime); if (LifeSpan != TimeSpan.Zero && elapsedLife > LifeSpan) { ParticleManager.Remove(this); } }
public override void Apply(GameTime gameTime, Particle particle) { particle.Position += particle.Velocity * Stcs.PPS1(gameTime); if (particle.LifeSpan != TimeSpan.Zero && particle.ElapsedLife > particle.LifeSpan) { if (particle.ElapsedLife > particle.LifeSpan + particle.TransitionOff) { particle.ParticleManager.Remove(particle); } else { particle.Alpha = (float)(1 - (particle.ElapsedLife - particle.LifeSpan).TotalSeconds / particle.TransitionOff.TotalSeconds); } } base.Apply(gameTime, particle); }
public override void Update(GameTime gameTime, bool hasFocus, bool covered) { cam.Update(); part.Update(gameTime); labbellX -= 700 * Stcs.PPS1(gameTime); if (labbellX < -500) { labbellX = ScreenManager.Res.X + 300;; } labbell.Bounds.X = (int)labbellX; pannell.Title = "Title test - Particle Count: " + part.ParticleCount; DebugOverlay.DebugText.Append(" :: TC - ").Append(Stcs.TC).AppendLine(); gui.Update(gameTime); base.Update(gameTime, hasFocus, covered); }
public override void Update(GameTime gameTime) { Random r = ParticleManager.R; var particles = new List <Particle>(); fogElapsed += Stcs.DilateTime(gameTime.ElapsedGameTime); if (fogElapsed > fogTarget) { fogElapsed = TimeSpan.Zero; particles.Add(new Particle(new Rectangle(16, 0, 32, 32), new SnowModifier()) { Position = new Vector2(r.Next(Bounds.Width), -8), Velocity = new Vector2(r.Next(4, 50), r.Next(120, 300)), Scale = 20f, LifeSpan = TimeSpan.FromSeconds(4), Tint = Color.White * .2f }); } rainElapsed += Stcs.DilateTime(gameTime.ElapsedGameTime); if (rainElapsed > rainTarget) { rainElapsed = TimeSpan.Zero; particles.Add(new Particle(new Rectangle(6, 0, 6, 16), new BasicModifier()) { Position = new Vector2(r.Next(Bounds.Width), -8), Velocity = new Vector2(r.Next(20, 100), r.Next(500, 1500)), Scale = (float)r.NextDouble() / 4 + .5f, LifeSpan = TimeSpan.FromSeconds(4), Tint = Color.Blue }); } ParticleManager.AddParticles(particles); base.Update(gameTime); }
public override void Apply(GameTime gameTime, Particle particle) { particle.Velocity.X -= 100 * Stcs.PPS1(gameTime); base.Apply(gameTime, particle); }