private static void GetAllNodesByVert(ref List <PathfindingUtility.TMNodeInfo> nodeInfos, TriangleMeshNode startNode, int vertIndex)
    {
        if (nodeInfos == null)
        {
            nodeInfos = new List <PathfindingUtility.TMNodeInfo>();
        }
        for (int i = 0; i < nodeInfos.get_Count(); i++)
        {
            if (nodeInfos.get_Item(i).node == startNode)
            {
                return;
            }
        }
        int num;

        if (startNode.v0 == vertIndex)
        {
            num = 0;
        }
        else if (startNode.v1 == vertIndex)
        {
            num = 1;
        }
        else
        {
            if (startNode.v2 != vertIndex)
            {
                return;
            }
            num = 2;
        }
        PathfindingUtility.TMNodeInfo tMNodeInfo = default(PathfindingUtility.TMNodeInfo);
        tMNodeInfo.vi   = num;
        tMNodeInfo.node = startNode;
        tMNodeInfo.v0   = startNode.GetVertex(num % 3);
        tMNodeInfo.v1   = startNode.GetVertex((num + 1) % 3);
        tMNodeInfo.v2   = startNode.GetVertex((num + 2) % 3);
        nodeInfos.Add(tMNodeInfo);
        if (startNode.connections != null)
        {
            for (int j = 0; j < startNode.connections.Length; j++)
            {
                TriangleMeshNode triangleMeshNode = startNode.connections[j] as TriangleMeshNode;
                if (triangleMeshNode != null && triangleMeshNode.GraphIndex == startNode.GraphIndex)
                {
                    PathfindingUtility.GetAllNodesByVert(ref nodeInfos, triangleMeshNode, vertIndex);
                }
            }
        }
    }
 private static void MoveFromNode(TriangleMeshNode node, int startEdge, VInt3 srcLoc, VInt3 destLoc, MoveDirectionState state, out VInt3 result)
 {
     result = srcLoc;
     while (node != null)
     {
         int count = 2;
         int i;
         if (node.IsVertex(srcLoc, out i))
         {
             int vertexIndex = node.GetVertexIndex(i);
             List <PathfindingUtility.TMNodeInfo> list = null;
             PathfindingUtility.GetAllNodesByVert(ref list, node, vertexIndex);
             TriangleMeshNode triangleMeshNode = null;
             int num = -1;
             for (int j = 0; j < list.get_Count(); j++)
             {
                 PathfindingUtility.TMNodeInfo tMNodeInfo = list.get_Item(j);
                 if (!PathfindingUtility.checkedNodes.Contains(tMNodeInfo.node) && !Polygon.LeftNotColinear(tMNodeInfo.v0, tMNodeInfo.v2, destLoc) && Polygon.Left(tMNodeInfo.v0, tMNodeInfo.v1, destLoc))
                 {
                     triangleMeshNode = tMNodeInfo.node;
                     num = tMNodeInfo.vi;
                     break;
                 }
             }
             if (triangleMeshNode != null)
             {
                 node      = triangleMeshNode;
                 startEdge = (num + 1) % 3;
                 count     = 1;
             }
             else
             {
                 int     edge = -1;
                 VFactor b    = new VFactor
                 {
                     nom = -2L,
                     den = 1L
                 };
                 for (int k = 0; k < list.get_Count(); k++)
                 {
                     PathfindingUtility.TMNodeInfo tMNodeInfo2 = list.get_Item(k);
                     if (!PathfindingUtility.checkedNodes.Contains(tMNodeInfo2.node))
                     {
                         int     num2;
                         VFactor cosineAngle = tMNodeInfo2.GetCosineAngle(destLoc, state, out num2);
                         if (cosineAngle > b)
                         {
                             b                = cosineAngle;
                             edge             = num2;
                             triangleMeshNode = tMNodeInfo2.node;
                         }
                     }
                 }
                 if (triangleMeshNode != null)
                 {
                     PathfindingUtility.MoveAlongEdge(triangleMeshNode, edge, srcLoc, destLoc, state, out result, true);
                     break;
                 }
             }
         }
         int num3;
         if (startEdge == -1)
         {
             num3 = node.EdgeIntersect(srcLoc, destLoc);
         }
         else
         {
             num3 = node.EdgeIntersect(srcLoc, destLoc, startEdge, count);
         }
         if (num3 == -1)
         {
             if (node.ContainsPoint(destLoc))
             {
                 result = destLoc;
                 if (PathfindingUtility.MoveAxisY)
                 {
                     PathfindingUtility.CalculateY(ref result, node);
                 }
             }
             else
             {
                 num3 = node.GetColinearEdge(srcLoc, destLoc);
                 if (num3 != -1)
                 {
                     PathfindingUtility.MoveAlongEdge(node, num3, srcLoc, destLoc, state, out result, true);
                 }
             }
             break;
         }
         int num4;
         TriangleMeshNode neighborByEdge = node.GetNeighborByEdge(num3, out num4);
         if (neighborByEdge == null)
         {
             PathfindingUtility.MoveAlongEdge(node, num3, srcLoc, destLoc, state, out result, true);
             break;
         }
         node      = neighborByEdge;
         startEdge = num4 + 1;
     }
 }