public void RandomizeParticles(IList <MassParticle> particles, Transform origin) { for (int rb = 0; rb < particles.Count; ++rb) { MassParticle particle = particles[rb]; float speed = Random.Range(MinSpeed, MaxSpeed); particle.Rigidbody.velocity = speed * Random.insideUnitSphere; float x = Random.Range(0f, MaxXDistanceFromOrigin); float y = Random.Range(0f, MaxYDistanceFromOrigin); float z = Random.Range(0f, MaxZDistanceFromOrigin); particle.Rigidbody.position = origin.TransformPoint(x, y, z); float scale = Random.Range(MinScale, MaxScale); particle.RootTransform.localScale = scale * Vector3.one; particle.Rigidbody.SetDensity(Density); } }
public void RemoveParticle(MassParticle particle) => _particles.Remove(particle);
public void AddParticle(MassParticle particle) => _particles.Add(particle);