Exemple #1
0
        private void AddParticleGroup(WaveParticlesGroup group)
        {
            if (particleGroups.Length == numParticleGroups)
            {
                System.Array.Resize(ref particleGroups, numParticleGroups << 1);
            }

            for (++lastGroupIndex; lastGroupIndex < particleGroups.Length; ++lastGroupIndex)
            {
                if (particleGroups[lastGroupIndex] == null)
                {
                    ++numParticleGroups;
                    particleGroups[lastGroupIndex] = group;
                    return;
                }
            }

            for (lastGroupIndex = 0; lastGroupIndex < particleGroups.Length; ++lastGroupIndex)
            {
                if (particleGroups[lastGroupIndex] == null)
                {
                    ++numParticleGroups;
                    particleGroups[lastGroupIndex] = group;
                    return;
                }
            }
        }
Exemple #2
0
        private bool HasParticleGroup(WaveParticlesGroup group)
        {
            for (int i = 0; i < particleGroups.Length; ++i)
            {
                if (particleGroups[i] == group)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #3
0
        private bool RectContainsParticleGroup(WaveParticlesGroup group)
        {
            var particle = group.leftParticle;

            if (!particle.isAlive)
            {
                return(false);
            }

            do
            {
                if (marginRect.Contains(particle.position))
                {
                    return(true);
                }

                particle = particle.rightNeighbour;
            }while(particle != null);

            return(false);
        }