Procházet zdrojové kódy

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

大爷 před 1 rokem
rodič
revize
65cebcd908

+ 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;