소스 검색

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

大爷 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;