Exemplo n.º 1
0
 public bool Collides(RigidBody other)
 {
     //circle vs circle collision
     //return BoundingCircle.Collides(other.BoundingCircle);
     if (BoundingCircle.Collides(other.BoundingCircle))
     {
         if (BoundingBox != null && other.BoundingBox != null)
         {
             //rect vs rect collision
             return(BoundingBox.Collides(other.BoundingBox));
         }
         else
         {
             if (BoundingBox != null)
             {
                 //rect vs circle
                 return(BoundingBox.Collides(other.BoundingCircle));
             }
             else if (other.BoundingBox != null)
             {
                 return(other.BoundingBox.Collides(other.BoundingCircle));
             }
             else
             {
                 //none has rect
                 return(true);
             }
         }
     }
     return(false);
 }
Exemplo n.º 2
0
 public bool Collides(RigidBody other, ref Collision collisionInfo)
 {
     //circle vs circle collision
     if (BoundingCircle.Collides(other.BoundingCircle))
     {
         if (BoundingBox != null && other.BoundingBox != null)
         {
             //rect vs rect
             return(BoundingBox.Collides(other.BoundingBox, ref collisionInfo));
         }
         else
         {
             if (BoundingBox != null)
             {
                 //rect vs circle
                 return(BoundingBox.Collides(other.BoundingCircle));
             }
             else if (other.BoundingBox != null)
             {
                 //other rect vs my circle
                 return(other.BoundingBox.Collides(BoundingCircle));
             }
             else
             {
                 //none has rect
                 return(true);
             }
         }
     }
     return(false);
 }
 public bool Collides(RigidBody other, ref Collision collInfo)
 {
     if (BoundingCircle.Collides(other.BoundingCircle))
     {
         if (BoundingBox != null && other.BoundingBox != null)
         {
             return(BoundingBox.Collides(other.BoundingBox, ref collInfo));
         }
         else
         {
             if (BoundingBox != null)
             {
                 return(BoundingBox.Collides(other.BoundingCircle));
             }
             else if (other.BoundingBox != null)
             {
                 return(other.BoundingBox.Collides(BoundingCircle));
             }
             else
             {
                 return(true);
             }
         }
     }
     return(false);
 }