コード例 #1
0
 static bool GetSingleSingleCollision(CircleCollisionSystem c1, CircleCollisionSystem c2)
 {
     return c1.IsCollision(c1.GetCollisionTarget(), c2.GetCollisionTarget());
 }
コード例 #2
0
 static bool GetSingleMultiCollisionPredict(CircleCollisionSystem single, CircleCollisionSystem multi)
 {
     if (multi.IsNeedPredict())
     {
         return single.IsCollision(multi.GetPredictateCollisionTarget(), single.GetCollisionTarget());
     }
     else
     {
         return true;
     }
 }
コード例 #3
0
 static bool GetMultiMultiCollisionPredict(CircleCollisionSystem c1, CircleCollisionSystem c2)
 {
     bool p1 = c1.IsNeedPredict();
     bool p2 = c2.IsNeedPredict();
     if (!p1 && !p2)
     {
         return true;
     }
     if (p1 && p2)
     {
         return c1.IsCollision(c1.GetPredictateCollisionTarget(), c2.GetPredictateCollisionTarget());
     }
     if (p1 && !p2)
     {
         return GetSingleMultiCollision(c1.GetPredictateCollisionTarget(), c2);
     }
     if (!p1 && p2)
     {
         return GetSingleMultiCollision(c2.GetPredictateCollisionTarget(), c1);
     }
     return true;
 }
コード例 #4
0
 static bool GetSingleMultiCollision(CollisionTarget single, CircleCollisionSystem multi)
 {
     return multi.Collisions.Any(i => multi.IsCollision(i.GetCollisionTarget(), single));
 }
コード例 #5
0
 static bool GetMultiMultiCollision(CircleCollisionSystem c1, CircleCollisionSystem c2)
 {
     if (!GetMultiMultiCollisionPredict(c1, c2))
     {
         return false;
     }
     return c1.Collisions
         .Select(i => i.GetCollisionTarget())
         .Any(i =>
             c2.Collisions
             .Select(j => j.GetCollisionTarget())
             .Any(j => c1.IsCollision(i, j))
         );
 }