Пример #1
0
        public void _Update()
        {
            for (int i = 0; i < particles.Count; i++)
            {
                particles[i].WorldForces += ForceManager.AccumulateForces(particles[i]);
                particles[i].Update();
            }

            List <Dictionary <string, Vector2> > volumetricForces =
                ForceManager.AccumulateVolumetricForces();

            if (volumetricForces != null)
            {
                foreach (Dictionary <string, Vector2> accum in volumetricForces)
                {
                    if (accum != null)
                    {
                        for (int i = 0; i < accum.Count; i++)
                        {
                            for (int j = 0; j < particles.Count; i++)
                            {
                                if (particles[j].AttachedToID != "None")
                                {
                                    Vector2 vec = (from s in accum.Keys
                                                   where s == particles[j].AttachedToID
                                                   select accum[s]).FirstOrDefault();

                                    if (vec != null)
                                    {
                                        particles[j].WorldForces += vec;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }