public IEnumerable <SimObject> DetectCollisions(SimObject collidingObject) { foreach (var simObject in GetSimObjectsCopy()) { if (collidingObject != simObject && _collisionDetection.IsCollision(collidingObject, simObject)) { yield return(simObject); } } }
public IEnumerable <SimObject> DetectCollisions(SimObject collidingObject) { var collidingObjects = new List <SimObject>(); foreach (var simObject in SimObjects) { if (collidingObject != simObject && _collisionDetection.IsCollision(collidingObject, simObject)) { yield return(simObject); } } }