Esempio n. 1
0
 public static IEnumerable <LSBody> RaycastAll(Vector2d start, Vector2d end)
 {
     _Version++;
     LSBody.PrepareAxisCheck(start, end);
     foreach (FractionalLineAlgorithm.Coordinate coor in
              GetRelevantNodeCoordinates(start, end))
     {
         int indexX = coor.X;
         int indexY = coor.Y;
         if (!Partition.CheckValid(coor.X, coor.Y))
         {
             break;
         }
         PartitionNode node = Partition.GetNode(indexX, indexY);
         for (int i = node.ContainedDynamicObjects.Count - 1; i >= 0; i--)
         {
             LSBody body = PhysicsManager.SimObjects[node.ContainedDynamicObjects[i]];
             if (body.IsNotNull() && body.RaycastVersion != _Version)
             {
                 if (Conditional.IsNull() || Conditional())
                 {
                     body.RaycastVersion = _Version;
                     if (body.Overlaps(bufferIntersectionPoints))
                     {
                         yield return(body);
                     }
                 }
             }
         }
     }
     Conditional = null;
     yield break;
 }
Esempio n. 2
0
 public static IEnumerable <LSBody> RaycastAll(Vector2d start, Vector2d end)
 {
     LSBody.PrepareAxisCheck(start, end);
     foreach (FractionalLineAlgorithm.Coordinate coor in
              GetRelevantNodeCoordinates(start, end))
     {
         int indexX = coor.X;
         int indexY = coor.Y;
         if (!Partition.CheckValid(coor.X, coor.Y))
         {
             break;
         }
         PartitionNode node = Partition.GetNode(indexX, indexY);
         for (int i = node.ContainedObjects.Count - 1; i >= 0; i--)
         {
             LSBody body = PhysicsManager.SimObjects [node.ContainedObjects [i]];
             if (body.Overlaps())
             {
                 yield return(body);
             }
         }
     }
     yield break;
 }