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; }
/// <summary> /// Allows a new particle system to be managed by the particle /// manager. /// </summary> /// <param name="psystem"></param> public void Register(ParticleSystem psystem) { //Remember the type of the passed particle system particleSystemTypes.Add(psystem.GetType()); //Add the new particle system to the game's components game.Components.Add(psystem); }