private KeyValuePair <IFood, IDrawable> FindClosestFood(IDrawable fishDrawable) { var minDistance = double.MaxValue; var fishCenterPoint = fishDrawable.GetCenterPoint(); var result = new KeyValuePair <IFood, IDrawable>(); foreach (var foodPair in foodDictionary) { var foodDrawable = foodPair.Value; var foodCenterPoint = foodDrawable.GetCenterPoint(); var distance = fishCenterPoint.GetVectorToPoint(foodCenterPoint).Length; if (!(distance < minDistance)) { continue; } minDistance = distance; result = foodPair; } return(result); }