public void SetNodes(List <WDOMNode> points) { int first_index = m_FirstEntryOffset / 16; if (first_index >= points.Count) { return; } FirstNode = (PathPoint_v1)points[first_index]; FirstNode.Name = Name + $"_{0}"; PathPoint_v1 cur_node = FirstNode; for (int i = 1; i < m_NumberofPoints; i++) { int next_index = first_index + i; if (next_index >= points.Count) { break; } cur_node.NextNode = (PathPoint_v1)points[next_index]; cur_node.NextNode.Name = Name + $"_{i}"; cur_node = cur_node.NextNode; } }
public List <PathPoint_v1> GetPoints() { List <PathPoint_v1> points = new List <PathPoint_v1>(); PathPoint_v1 nextPoint = FirstNode; while (nextPoint != null) { points.Add(nextPoint); nextPoint = nextPoint.NextNode; if (nextPoint == FirstNode) { break; // Prevent infinite loops } } return(points); }