//------------------------------------------------------------------------- public static void Test() { EbDoubleLinkList2 <int> list = new EbDoubleLinkList2 <int>(); EbDoubleLinkNode2 <int> node1 = new EbDoubleLinkNode2 <int>(); node1.Data = 1; EbDoubleLinkNode2 <int> node2 = new EbDoubleLinkNode2 <int>(); node2.Data = 2; list.PushBack(node1); list.PushBack(node2); {// 正向迭代 EbDoubleLinkNode2 <int> iter = list.GetHead(); while (!list.IsEnd(iter)) { int value = iter.Data; EbDoubleLinkList2 <int> .Next(ref iter); } } {// 反向迭代 EbDoubleLinkNode2 <int> iter = list.GetTail(); while (!list.IsEnd(iter)) { int value = iter.Data; EbDoubleLinkList2 <int> .Pre(ref iter); } } }
//--------------------------------------------------------------------- public float Length() { float len = 0.0f; EbVector3 pos_pre = mCurrentPos; EbDoubleLinkNode2 <EbRouteNode> iter = mListNode.GetHead(); while (!mListNode.IsEnd(iter)) { EbRouteNode value = iter.Data; EbDoubleLinkList2 <EbRouteNode> .Next(ref iter); len += Distance(value._pos, pos_pre); pos_pre = value._pos; } return(len); }
//--------------------------------------------------------------------- public void Reset() { EbDoubleLinkNode2 <EbAstarStep> iter = mOpenList.GetHead(); while (!mOpenList.IsEnd(iter)) { iter.Data.Clear(); EbDoubleLinkList2 <EbAstarStep> .Next(ref iter); } mOpenList.Clear(); iter = mCloseList.GetHead(); while (!mCloseList.IsEnd(iter)) { iter.Data.Clear(); EbDoubleLinkList2 <EbAstarStep> .Next(ref iter); } mCloseList.Clear(); mOpenHeap.Clear(); }