static bool GetSingleSingleCollision(CircleCollisionSystem c1, CircleCollisionSystem c2) { return c1.IsCollision(c1.GetCollisionTarget(), c2.GetCollisionTarget()); }
static bool GetSingleMultiCollisionPredict(CircleCollisionSystem single, CircleCollisionSystem multi) { if (multi.IsNeedPredict()) { return single.IsCollision(multi.GetPredictateCollisionTarget(), single.GetCollisionTarget()); } else { return true; } }
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; }
static bool GetSingleMultiCollision(CollisionTarget single, CircleCollisionSystem multi) { return multi.Collisions.Any(i => multi.IsCollision(i.GetCollisionTarget(), single)); }
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)) ); }