コード例 #1
0
        public bool RemoveRandomParticle(ParticleCollection sector)
        {
            // If no sector is provided to remove from, semirandomly pick a sector from the last update.
            if (sector == null)
            {
                if (_SectorsFromLastUpdate.Count == 0)
                {
                    return(false);
                }

                var index = RNG.Next(0, _SectorsFromLastUpdate.Count);
                sector = _SectorsFromLastUpdate.GetBuffer()[index];
            }

            if (sector.Count == 0)
            {
                return(false);
            }

            var particleIndex = RNG.Next(0, sector.Count);

            sector.RemoveAt(particleIndex);

            return(true);
        }