void ApplyGravity() { foreach (GameObject elasticBody in elasticBodies) { ElasticBodyController ebc = elasticBody.GetComponent <ElasticBodyController>(); ApplyGravity(ebc.getParticles()); } ApplyGravity(particles); }
List <ParticleController> getAllElasticParticles() { List <GameObject> allParticles = new List <GameObject>(); List <ParticleController> allParticleControllers = new List <ParticleController>(); allParticles.AddRange(particles); foreach (GameObject elasticBody in elasticBodies) { ElasticBodyController bc = elasticBody.GetComponent <ElasticBodyController>(); allParticles.AddRange(bc.getParticles()); } foreach (GameObject particle in allParticles) { ParticleController ctrl = particle.GetComponent <ParticleController>(); allParticleControllers.Add(ctrl); } return(allParticleControllers); }