示例#1
0
        public virtual void Update(GameTime gameTime)
        {
            elapsedLife += Stcs.DilateTime(gameTime.ElapsedGameTime);

            foreach (var modifier in Modifiers)
            {
                modifier.Apply(gameTime, this);
            }
        }
示例#2
0
        public virtual void Update(GameTime gameTime)
        {
            elapsedLife += Stcs.DilateTime(gameTime.ElapsedGameTime);

            if (LifeSpan != TimeSpan.Zero && elapsedLife > LifeSpan)
            {
                ParticleManager.Remove(this);
            }
        }
示例#3
0
        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);
        }