Beispiel #1
0
 public IEnumerable <(Entity entity, float distance)> GetCollisions(ICollider source)
 {
     foreach (var e in _entities)
     {
         var targetLocation = e.Location();
         var target         = e.GetComponent <CollisionComponent>().GetCollider(targetLocation);
         if (source.HasCollided(target))
         {
             var distance = Vector2.Distance(source.Location, targetLocation);
             yield return(e, distance);
         }
     }
 }