Пример #1
0
        public static bool EnemyWithParticleSystem(ParticleSystem system, Sprite enemy)
        {
            //Get the list of active particles' bounding spheres.
            List<BoundingSphere> pSpheres = system.GetActiveParticlesSpheres();

            //Check the particle spheres against the enemy's general bounding sphere

            foreach (BoundingSphere s in pSpheres)
                //If there is a collision
                if (s.Intersects(enemy.generalBoundingSphere))
                {
                    //Check the more detailed spheres
                    foreach (BoundingSphere es in enemy.boundingSphereList)
                        if (s.Intersects(es))
                            return true;
                }
            return false;
        }
Пример #2
0
        public static bool EnemyWithParticleSystem(ParticleSystem system, Sprite enemy)
        {
            //Get the list of active particles' bounding spheres.
            List <BoundingSphere> pSpheres = system.GetActiveParticlesSpheres();

            //Check the particle spheres against the enemy's general bounding sphere

            foreach (BoundingSphere s in pSpheres)
            {
                //If there is a collision
                if (s.Intersects(enemy.generalBoundingSphere))
                {
                    //Check the more detailed spheres
                    foreach (BoundingSphere es in enemy.boundingSphereList)
                    {
                        if (s.Intersects(es))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }