Exemplo n.º 1
0
 public void CheckCollisions(Collidable[] CollidableList)
 {
     foreach (Collidable collidableObject in CollidableList)
     {
         if (collidableObject != null)
         {
             BoundingSphere sphere1 = new BoundingSphere(collidableObject.BoundingSphereCenter, collidableObject.BoundingSphereRadius);
             foreach (Collidable collidableObject2 in CollidableList)
             {
                 if (collidableObject2 != null)
                 {
                     if (!Object.Equals(collidableObject, collidableObject2))
                     {
                         BoundingSphere sphere2 = new BoundingSphere(collidableObject2.BoundingSphereCenter, collidableObject2.BoundingSphereRadius);
                         if (sphere1.Intersects(sphere2))
                         {
                             if(collidableObject.BoundingSphereCenter != Vector3.Zero || collidableObject2.BoundingSphereCenter != Vector3.Zero)
                                 collidableObject.Collision(collidableObject2.CollidableType);
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 public void AddToCollidableList(Collidable collidableObject)
 {
     CollidableList.Add(collidableObject);
 }