예제 #1
0
        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);
            }
        }
예제 #2
0
 public void RemoveParticle(MassParticle particle) => _particles.Remove(particle);
예제 #3
0
 public void AddParticle(MassParticle particle) => _particles.Add(particle);