diff --git a/Assets/Scripts/Mechanics/EnemyController.cs b/Assets/Scripts/Mechanics/EnemyController.cs index 97b32c1..02dc5fb 100644 --- a/Assets/Scripts/Mechanics/EnemyController.cs +++ b/Assets/Scripts/Mechanics/EnemyController.cs @@ -197,13 +197,21 @@ namespace Platformer.Mechanics if (startTm == null) return 0f; // 좌·우 연속 Tile 영역 끝 영역 검색 + // BT111 (2026-05-08) — 위·아래 1 cell 인접 cell도 검색 (계단 영역 발판 연속 정합) + // PD 보고: 좁은 영역 1 cell 폭 발판 위 Enemy patrol 거리 0 + // 근본: 좌·우 same-y cell 즉시 break → 계단·1 cell 폭 영역 발판 연속 미감지 + // 정정: 다음 same-y / +1 / -1 중 어느 곳이라도 HasTile = 발판 연속 int dirCell = (int)Mathf.Sign(dir); Vector3Int cellIter = startCell; for (int steps = 0; steps < 500; steps++) { - Vector3Int nextCell = cellIter + new Vector3Int(dirCell, 0, 0); - if (!HasTileInAnyTilemap(groundTilemaps, nextCell)) break; - cellIter = nextCell; + Vector3Int nextSame = cellIter + new Vector3Int(dirCell, 0, 0); + Vector3Int nextUp = nextSame + Vector3Int.up; + Vector3Int nextDown = nextSame + Vector3Int.down; + if (HasTileInAnyTilemap(groundTilemaps, nextSame)) cellIter = nextSame; + else if (HasTileInAnyTilemap(groundTilemaps, nextUp)) cellIter = nextUp; + else if (HasTileInAnyTilemap(groundTilemaps, nextDown)) cellIter = nextDown; + else break; } // 마지막 Tile cell 영역 center 영역까지 거리