Polygon.GetHitInfoByPolyIndex C# (CSharp) Method

GetHitInfoByPolyIndex() private method

private GetHitInfoByPolyIndex ( int index, List infos ) : List
index int
infos List
return List
    List<HitInfo> GetHitInfoByPolyIndex(int index, List<HitInfo> infos)
    {
        List<HitInfo> res = new List<HitInfo>();
        foreach (HitInfo info in infos){
            if (info.polygonLine == index){
                res.Add(info);
            }
        }
        Vector3 pos = vertices[index];
        res.Sort(delegate(HitInfo hit1, HitInfo hit2){
            float dist1 = (hit1.intersectionPoint3D - pos).sqrMagnitude;
            float dist2 = (hit2.intersectionPoint3D - pos).sqrMagnitude;
            return dist1 < dist2 ? -1 : 1;
        });
        return res;
    }