示例#1
0
        public override void Update(double dt)
        {
            for (int i = 0; i < Particles.Count; i++)
            {
                for (int j = 0; j < GravityPoints.Count; j++)
                {
                    var particle     = Particles[i];
                    var gravityPoint = GravityPoints[j];

                    var normDir = Vec2.Direction(particle.Position, gravityPoint).Normalize();

                    particle.Velocity += normDir * particle.Speed * dt;
                    particle.Position += particle.Velocity * dt;

                    Particles[i] = particle;
                }
            }
        }