public static void ChangeArea(Rect rect, bool clear) { int startX = Mathf.RoundToInt(rect.x); int startY = Mathf.RoundToInt(rect.y); int w = Mathf.RoundToInt(rect.width); int h = Mathf.RoundToInt(rect.height); for (int y = startY; y < startY + h + 1; y++) { for (int x = startX; x < startX + w + 1; x++) { Vector2 pos = cur.WorldToNode(new Vector3(x, y)); int xx = Mathf.RoundToInt(pos.x); int yy = Mathf.RoundToInt(pos.y); if (cur.IsInsideField(xx, yy)) { cur.nodes[xx, yy].isClear = clear; if (Game.isWalled[xx, yy] != Game.WallType.None) { cur.nodes[xx, yy].isClear = false; } } } } if (cur.debugDynamicUpdate) { Dijkstra.BakePaths(); } }