SimShift.MapTool.Ets2Mapper.FindClosestRoadPrefab C# (CSharp) 메소드

FindClosestRoadPrefab() 공개 메소드

public FindClosestRoadPrefab ( PointF location ) : Ets2Item
location System.Drawing.PointF
리턴 Ets2Item
        public Ets2Item FindClosestRoadPrefab(PointF location)
        {
            // Find road or prefab closest by
            var closestPrefab =
                Items.Values.Where(x => x.HideUI==false && x.Type == Ets2ItemType.Prefab && x.Prefab != null && x.Prefab.Curves.Any())
                    .OrderBy(x => Math.Sqrt(Math.Pow(location.X - x.PrefabNode.X, 2) + Math.Pow(location.Y - x.PrefabNode.Z, 2)))
                    .FirstOrDefault();
            return closestPrefab;
        }