예제 #1
0
파일: GameEngine.cs 프로젝트: robertg/Soar
 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);
                         }
                     }
                 }
             }
         }
     }
 }
예제 #2
0
파일: GameEngine.cs 프로젝트: robertg/Soar
 public void AddToCollidableList(Collidable collidableObject)
 {
     CollidableList.Add(collidableObject);
 }