Ejemplo n.º 1
0
        public void Update(GameTime gameTime)
        {
            EmissionPoint = EmitterLocation;
            TTL.Update(gameTime.ElapsedGameTime);
            if (!Started)
            {
                Started = true;
                OnStart(this);
            }
            if (!TTL.IsComplete && Particles.Count < Max)
            {
                Emit(gameTime);
            }

            foreach (var m in Modifiers.Where(p => !p.IsPattern))
            {
                m.Update(gameTime, this);
            }

            for (var particle = 0; particle < Particles.Count; particle++)
            {
                Particles[particle].Update(gameTime);
                if (!Particles[particle].TTL.IsComplete)
                {
                    continue;
                }
                Particles.RemoveAt(particle);
                particle--;
            }
            if (Ended || !TTL.IsComplete)
            {
                return;
            }
            Ended = true;
            OnEnd(this);
        }