瀏覽代碼

修复在寻路到不可到达目标时,选取的附近路点可能仍然是不可到达点的问题

大爷 1 年之前
父節點
當前提交
65cebcd908
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Common/CommonAI/Zone/Instance/InstanceZone.Terrain.cs

+ 2 - 2
Common/CommonAI/Zone/Instance/InstanceZone.Terrain.cs

@@ -390,7 +390,7 @@ namespace CommonAI.Zone.Instance
                         float x = dstx + dx * W * vx;
                         if (MathVector.getDistanceSquare(x, yy, dstx, dsty) < squCircle)
                         {
-                            if (!path_finder.TouchMapBlock(((int)x) / W, ((int)yy) / H))
+                            if (!path_finder.TouchMapBlock(((int)x) / W, ((int)yy) / H) && findPath(sx, sy, x, yy) != null)
                             {
                                 outx = x;
                                 outy = yy;
@@ -404,7 +404,7 @@ namespace CommonAI.Zone.Instance
                         float y = dsty + dy * H * vy;
                         if (MathVector.getDistanceSquare(xx, y, dstx, dsty) < squCircle)
                         {
-                            if (!path_finder.TouchMapBlock(((int)xx) / W, ((int)y) / H))
+                            if (!path_finder.TouchMapBlock(((int)xx) / W, ((int)y) / H) && findPath(sx, sy, xx, y) != null)
                             {
                                 outx = xx;
                                 outy = y;