public ParticleSystem.Particle[] AddParticles(ParticleSystem.Particle[] particles, int particlesToAdd) { int setAABCCount = this.GetSetAABCCount(); int max = ((int)this.side) / 2; int num4 = 0; int index = 0; if (particlesToAdd <= 0) { throw new ArgumentException("The number of particles to add is < 0"); } int num2 = particlesToAdd / setAABCCount; if (num2 <= 0) { num2 = 1; } while (particlesToAdd > 0) { AABCGridSetAABCIterator iterator = new AABCGridSetAABCIterator(this); int num6 = 0; while (iterator.HasNext()) { AABC aabc = iterator.Next(); while ((index < (num4 + num2)) && (particlesToAdd > 0)) { particles[index].position = aabc.GetCenter() + ((Vector3)(new Vector3((float)UnityEngine.Random.Range(-max, max), (float)UnityEngine.Random.Range(-max, max), (float)UnityEngine.Random.Range(-max, max)) / 100f)); particlesToAdd--; index++; } num4 += num2; num6++; if (particlesToAdd <= 0) { break; } } if (particlesToAdd > 0) { num2 = 1; } } return(particles); }
public AABC(AABC aABC) : base(aABC) { this.grid = aABC.grid; }