亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? simplepathfinder.cs

?? A .NET Path Finder Library Path Finder Library is a .NET library that currently contains one type c
?? CS
字號(hào):
using System;
using System.Collections.Generic;

namespace HenizeSoftware
{
  namespace PathFinding
  {
    /// <summary>
    /// The SimplePathFinder type is for finding the shortest path from point A to point B is some kind of
    /// 2D maze or map. It is extrememly simple and basic.
    /// </summary>
    public class SimplePathFinder
    {
      Map nodeMap;

      Node startNode;
      Node endNode;

      Queue<Node> finalPath = new Queue<Node>();

      bool isPathCalculated;

      /// <summary>
      /// Allows you to edit the two-diminsional map of nodes. Set to true for unwalkable.
      /// </summary>
      /// <param name="x">The x diminsion on the map.</param>
      /// <param name="y">The y diminsion on the map.</param>
      /// <returns>Returns wether node at coordinate x, y is walkable(false) or unwalkable(true)</returns>
      public bool this[int x, int y]
      {
        get { return nodeMap[(ushort)x, (ushort)y]; }
        set
        {
          nodeMap[(ushort)x, (ushort)y] = value;
          isPathCalculated = false;
        }
      }
      /// <summary>
      /// The starting position from where the search for the end position begins.
      /// </summary>
      public Coordinate StartNodePosition
      {
        get { return new Coordinate(startNode.X, startNode.Y); }
        set
        {
          startNode.X = (ushort)value.X;
          startNode.Y = (ushort)value.Y;
          isPathCalculated = false;
        }
      }
      
      /// <summary>
      /// The ending position to where the search to here from the start position ends.
      /// </summary>
      public Coordinate EndNodePosition
      {
        get { return new Coordinate(endNode.X, endNode.Y); }
        set
        {
          endNode.X = (ushort)value.X;
          endNode.Y = (ushort)value.Y;
          isPathCalculated = false;
        }
      }
      /// <summary>
      /// Gets a coordinate array containing the path from the start position to the end position.
      /// </summary>
      public Coordinate[] Path
      {
        get
        {
          if (!isPathCalculated)
            FindPath();
          
          if (finalPath.Count == 0)
            throw new ApplicationException("Path not found, the start node or the end node is enclosed or do not exist, " + 
                                            "the starting node position is the same as the ending node position");

          Stack<Coordinate> coordinateStack = new Stack<Coordinate>();
          foreach (Node pathNode in finalPath)
          {
            coordinateStack.Push(new Coordinate(pathNode.X, pathNode.Y));
          }

          return coordinateStack.ToArray();
        }
      }

      /// <summary>
      /// You must specify the width, height, starting position, ending position, and any unwalkable nodes
      /// during creation of the SimplePathFinder.
      /// </summary>
      /// <param name="width">The width of the 2D map.</param>
      /// <param name="height">The height of the 2D map.</param>
      /// <param name="startNodePos">The coordinate of starting node.</param>
      /// <param name="endNodePos">The coordinate of the ending node.</param>
      /// <param name="unwalkableNodes">An array of coordinates containing the positions
      /// of any unwalkable nodes in the map. Pass in an empty array or null if there is none.</param>
      public SimplePathFinder(int width, int height, Coordinate startNodePos, 
                              Coordinate endNodePos, Coordinate[] unwalkableNodes)
      {
        nodeMap = new Map((ushort)width, (ushort)height, unwalkableNodes);
        endNode = new Node(null, null, nodeMap, endNodePos.X, endNodePos.Y);
        startNode = new Node(null, endNode, nodeMap, startNodePos.X, startNodePos.Y);
      }
      
      void FindPath()
      {
        SortedNodeList Open = new SortedNodeList();

        if (startNode == null || endNode == null || nodeMap == null)
          throw new ApplicationException("StartNodePosition, EndNodePosition, or the Map is not instantiated.");

        Open.Add(startNode);

        while (Open.Count > 0)
        {
          Node currentNode = Open.RemoveFirst();

          if (currentNode.Equals(endNode))
          {
            endNode.ParentNode = currentNode.ParentNode;
            break;
          }

          Node[] successors = currentNode.GetSuccessors();

          foreach (Node successorNode in successors)
          {
            int oFound = Open.IndexOf(successorNode);
            if(oFound > 0)
            {
              if (Open.NodeAt(oFound) <= currentNode)
              {
                continue;
              }
            }

            if (oFound >= 0)
              Open.RemoveAt(oFound);

            Open.Add(successorNode);
          }
        }

        Node p = endNode;
        
        //loop through and contruct the final path by following the parents 
        //of each node starting from the end node
        while(true)
        {
          finalPath.Enqueue(p);
          
          p = p.ParentNode;
          
          if (p == null)
            break;
          if (p.ParentNode != null && p.ParentNode.ParentNode != null)
          {
            //cleans and shortens the path by removing unecessary moves
            if (p.ParentNode.ParentNode.IsAjacentTo(p))
              p.ParentNode = p.ParentNode.ParentNode;
            //removes single node zigzags on x diminsion
            if (p.IsDiagonalTo(p.ParentNode) && p.ParentNode.IsDiagonalTo(p.ParentNode.ParentNode) &&
               p.X == p.ParentNode.ParentNode.X)
            {
              p.ParentNode.X = p.X;
            }
            //removes single node zigzags on y diminsion
            if (p.IsDiagonalTo(p.ParentNode) && p.ParentNode.IsDiagonalTo(p.ParentNode.ParentNode) &&
                p.Y == p.ParentNode.ParentNode.Y)
            {
              p.ParentNode.Y = p.Y;
            }
          }
        } 
        
        //if this is true then the there is no path or the start node is ontop of the end node.
        if (finalPath.Count == 1)
          finalPath.Clear();

        isPathCalculated = true;
      }
    }
  }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产wwwccc36天堂| 欧美精品一区二区三区很污很色的| 中文成人综合网| 国产成人在线电影| 亚洲国产高清在线观看视频| 成人免费视频视频在线观看免费 | 午夜久久久久久久久| 91国产精品成人| 首页国产欧美久久| 日韩欧美在线观看一区二区三区| 看国产成人h片视频| 久久婷婷色综合| 成人av午夜影院| 亚洲美女在线一区| 欧美精品九九99久久| 久99久精品视频免费观看| 久久久99精品久久| 99re免费视频精品全部| 亚洲成人黄色影院| 精品福利视频一区二区三区| 成人涩涩免费视频| 亚洲图片欧美色图| 欧美r级电影在线观看| 成人激情视频网站| 亚洲第一电影网| 亚洲激情第一区| 欧美日韩亚洲另类| 久久99精品视频| 自拍偷拍亚洲欧美日韩| 欧美高清你懂得| 国产成人av电影在线观看| 亚洲毛片av在线| 日韩欧美在线一区二区三区| fc2成人免费人成在线观看播放| 亚洲一区二区三区四区五区黄| 日韩精品中文字幕在线一区| www.久久久久久久久| 日日噜噜夜夜狠狠视频欧美人| 久久欧美中文字幕| 91成人免费在线| 韩国精品一区二区| 亚洲自拍偷拍图区| 国产欧美精品日韩区二区麻豆天美 | 欧美日韩国产精品自在自线| 国产自产高清不卡| 亚洲国产欧美一区二区三区丁香婷| 日韩视频123| 色猫猫国产区一区二在线视频| 精品无人区卡一卡二卡三乱码免费卡 | 色天天综合色天天久久| 毛片av一区二区| 一区二区中文视频| 久久先锋影音av鲁色资源| 欧美三级欧美一级| 成人精品视频一区二区三区| 老司机精品视频线观看86 | 亚洲精品国产一区二区精华液| 日韩视频一区二区在线观看| 色猫猫国产区一区二在线视频| 国产精品亚洲第一| 蜜臀久久久99精品久久久久久| 亚洲乱码国产乱码精品精可以看 | 欧美自拍偷拍午夜视频| 成人免费视频播放| 国产精品亚洲成人| 精品一区二区在线看| 婷婷开心激情综合| 亚洲制服丝袜av| 自拍偷拍欧美精品| 国产精品久久久久天堂| 久久久久久久久久久久久久久99 | youjizz久久| 国产一区二区不卡| 麻豆精品一区二区综合av| 午夜精品久久久久久| 亚洲一区二区三区四区中文字幕| 成人欧美一区二区三区小说| 秋霞成人午夜伦在线观看| 亚洲第一电影网| 亚洲综合色自拍一区| 一区二区三区中文在线观看| 亚洲欧洲成人av每日更新| 国产精品久久久久久久久搜平片| 久久久99精品久久| 久久精品一区四区| 日本一区二区在线不卡| 国产精品热久久久久夜色精品三区| 久久亚洲一区二区三区四区| 久久色在线视频| 久久无码av三级| 亚洲国产成人午夜在线一区| 欧美国产日韩在线观看| 国产精品久久久久影院| 自拍偷拍亚洲激情| 一区二区三区四区乱视频| 亚洲大片免费看| 手机精品视频在线观看| 久久99久久99| 国产成人精品一区二| 北条麻妃一区二区三区| 色狠狠一区二区| 欧美日韩国产综合视频在线观看| 欧美一区二区大片| 亚洲精品一区二区三区在线观看 | 欧美丝袜第三区| 欧美欧美欧美欧美| 欧美电视剧免费观看| 日韩精品每日更新| 狠狠色伊人亚洲综合成人| 成人免费毛片片v| 一本高清dvd不卡在线观看| 欧美人与性动xxxx| 久久在线观看免费| 亚洲欧美另类小说视频| 日韩影院免费视频| 国产呦萝稀缺另类资源| 91网页版在线| 欧美丰满少妇xxxbbb| 久久午夜国产精品| 樱桃国产成人精品视频| 狠狠网亚洲精品| 在线观看视频欧美| 久久综合久久综合亚洲| 伊人色综合久久天天人手人婷| 久久国内精品视频| jlzzjlzz欧美大全| 欧美一区二区精品在线| 中文字幕视频一区| 免费亚洲电影在线| 97se亚洲国产综合自在线不卡| 欧美一区二区三区视频免费播放 | 91老师片黄在线观看| 日韩一区二区三区精品视频| 亚洲欧美在线高清| 日韩1区2区3区| 91小视频免费看| 精品国产电影一区二区| 亚洲精品美国一| 国产剧情一区二区三区| 777奇米四色成人影色区| 国产精品网站在线观看| 日韩电影免费在线观看网站| 91在线国内视频| 2024国产精品| 日韩av在线播放中文字幕| 91麻豆免费看片| 国产亚洲人成网站| 蜜臀久久99精品久久久画质超高清| 91香蕉视频黄| 欧美国产一区二区在线观看| 久久99国内精品| 欧美欧美午夜aⅴ在线观看| 亚洲品质自拍视频| 成人午夜激情视频| 2020国产成人综合网| 日韩电影免费一区| 欧美日韩一区三区| 亚洲精品久久久蜜桃| 99riav久久精品riav| 欧美国产激情一区二区三区蜜月| 乱中年女人伦av一区二区| 欧美久久久久久蜜桃| 一级做a爱片久久| 北岛玲一区二区三区四区| 国产欧美日本一区视频| 国产精品一区在线| 欧美zozozo| 麻豆久久一区二区| 日韩一区二区麻豆国产| 日本特黄久久久高潮| 欧美久久一区二区| 午夜精品爽啪视频| 欧美日韩国产综合一区二区| 亚洲国产一区视频| 欧美日韩中文一区| 亚洲aaa精品| 欧美丰满美乳xxx高潮www| 天堂久久一区二区三区| 6080日韩午夜伦伦午夜伦| 天天综合网天天综合色| 欧美一级在线免费| 久久99热这里只有精品| 精品国产一区二区三区av性色| 日本高清不卡在线观看| 亚洲大片一区二区三区| 91精品国产一区二区| 美脚の诱脚舐め脚责91| 欧美精品一区男女天堂| 高清成人在线观看| 国产精品成人在线观看| 欧美在线视频日韩| 天堂久久一区二区三区| 久久综合九色综合欧美98| 国产精品一区免费视频| 亚洲人精品午夜| 69堂成人精品免费视频| 国产伦精品一区二区三区免费迷| 国产午夜一区二区三区| 91麻豆123| 七七婷婷婷婷精品国产|