BT5-Dev #95: PatrolPath path 영역 제거·velocity 즉시 반대 방향 (PD 명시)

PD 명시 (2026-05-08):
1. 가장자리 좌우 반복 잔존
2. 모든 Enemy의 PatrolPath 제거 + 자동 알고리즘만

정정 (BT95):
1. Scene Ingame.unity Enemy 인스턴스 path 영역 m_Modifications 12건 제거
   - Python 자동 영역 (PrefabInstance 영역에서 propertyPath: path 영역 삭제)
   - PatrolPath GameObject 영역은 Scene 잔존 (영향 X·EnemyController 영역 미참조)
2. EnemyController.cs:
   - PHASE_COOLDOWN 0.5 → 1.0 (긴 영역·좌우 반복 영구 차단)
   - 절벽·벽 검출 시 velocity.x = 0 → velocity.x = -moveDir * maxSpeed (즉시 반대 방향 큰 속도)
   - control.move.x = -moveDir 직접 (1 frame 지연 차단)

효과:
- velocity 영역 즉시 반대 방향 큰 속도 → 가장자리에서 빠르게 멀어짐
- 1초 cooldown = 충분 영역 멀어진 후 검출 활성 → 좌우 반복 X
- PatrolPath path 영역 m_Modifications 제거 = 자동 patrol 영역만 사용 (PD 명시)
This commit is contained in:
깃 관리자 2026-05-08 13:50:32 +09:00
parent e453d1d07e
commit 32012aa450
2 changed files with 14 additions and 70 deletions

View File

@ -4119,11 +4119,6 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 292457042}
m_Modifications:
- target: {fileID: 772289407653213039, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: path
value:
objectReference: {fileID: 1771592755}
- target: {fileID: 1605217082131907960, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: m_Controller
@ -16800,11 +16795,6 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 292457042}
m_Modifications:
- target: {fileID: 772289407653213039, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: path
value:
objectReference: {fileID: 269479144}
- target: {fileID: 1577774018119691272, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: m_Size.x
@ -121326,11 +121316,6 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 292457042}
m_Modifications:
- target: {fileID: 772289407653213039, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: path
value:
objectReference: {fileID: 1379753723}
- target: {fileID: 1605217082131907960, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: m_Controller
@ -125048,11 +125033,6 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 292457042}
m_Modifications:
- target: {fileID: 772289407653213039, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: path
value:
objectReference: {fileID: 130987214}
- target: {fileID: 1605217082131907960, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: m_Controller
@ -125483,11 +125463,6 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 292457042}
m_Modifications:
- target: {fileID: 772289407653213039, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: path
value:
objectReference: {fileID: 1830976161}
- target: {fileID: 1605217082131907960, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: m_Controller
@ -133710,11 +133685,6 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 292457042}
m_Modifications:
- target: {fileID: 772289407653213039, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: path
value:
objectReference: {fileID: 269479144}
- target: {fileID: 1577774018119691272, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: m_Size.x
@ -137705,11 +137675,6 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 292457042}
m_Modifications:
- target: {fileID: 772289407653213039, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: path
value:
objectReference: {fileID: 353788239}
- target: {fileID: 1577774018119691272, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: m_Size.x
@ -140548,11 +140513,6 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 292457042}
m_Modifications:
- target: {fileID: 772289407653213039, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: path
value:
objectReference: {fileID: 1586129521}
- target: {fileID: 1605217082131907960, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: m_Controller
@ -297366,11 +297326,6 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 292457042}
m_Modifications:
- target: {fileID: 772289407653213039, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: path
value:
objectReference: {fileID: 1981112390}
- target: {fileID: 1605217082131907960, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: m_Controller
@ -311588,11 +311543,6 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 292457042}
m_Modifications:
- target: {fileID: 772289407653213039, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: path
value:
objectReference: {fileID: 0}
- target: {fileID: 1605217082131907960, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: m_Controller
@ -317827,11 +317777,6 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 292457042}
m_Modifications:
- target: {fileID: 772289407653213039, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: path
value:
objectReference: {fileID: 1539890945}
- target: {fileID: 1605217082131907960, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: m_Controller
@ -320768,11 +320713,6 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 292457042}
m_Modifications:
- target: {fileID: 772289407653213039, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: path
value:
objectReference: {fileID: 1620406957}
- target: {fileID: 1577774018119691272, guid: f158aa2be3df6489185ef721f6fd79c1,
type: 3}
propertyPath: m_Size.x

View File

@ -40,8 +40,8 @@ namespace Platformer.Mechanics
private float _lastX; // 벽 정지 검출용
private float _stuckTimer; // 벽 정지 누적 시간
private float _waitTimer; // arrive 후 대기 누적 시간 (1~3초 random)
private float _phaseCooldown; // BT94: phase 전환 직후 절벽·벽 검출 비활성 시간
private const float PHASE_COOLDOWN = 0.5f;
private float _phaseCooldown; // phase 전환 직후 절벽·벽 검출 비활성 시간
private const float PHASE_COOLDOWN = 1.0f; // BT95: 0.5→1.0 — 긴 영역 cooldown (좌우 반복 영구 차단)
private float _maxRightRange; // BT94: 시작 시 측정 — 우측 안전 patrol 거리
private float _maxLeftRange; // BT94: 시작 시 측정 — 좌측 안전 patrol 거리
@ -171,7 +171,7 @@ namespace Platformer.Mechanics
// BT94 — 절벽·벽 검출은 phase cooldown 영역 끝난 후 활성 (좌우 반복 차단)
if (_phaseCooldown <= 0f)
{
// 절벽 검출 — velocity.x = 0 + phase+2 + cooldown 활성
// BT95 — 절벽 검출: velocity.x 즉시 반대 방향 큰 속도 (가장자리에서 빠르게 멀어짐)
if (_collider != null)
{
Vector2 footAhead = new Vector2(
@ -181,32 +181,36 @@ namespace Platformer.Mechanics
RaycastHit2D groundHit = Physics2D.Raycast(footAhead, Vector2.down, cliffCheckDepth, groundLayerMask);
if (groundHit.collider == null)
{
if (control != null) control.velocity = new Vector2(0f, control.velocity.y);
_patrolPhase = (_patrolPhase + 2) % 4;
SetNextPatrolTarget();
if (control != null)
{
control.velocity = new Vector2(-moveDir * control.maxSpeed, control.velocity.y);
control.move.x = -moveDir;
}
_stuckTimer = 0f;
_phaseCooldown = PHASE_COOLDOWN;
_lastX = transform.position.x;
dx = _targetX - transform.position.x;
if (control != null) control.move.x = Mathf.Clamp(dx, -1, 1);
return;
}
}
// 벽 정지 (stuckTimer 150ms): velocity.x = 0 + phase+2 + cooldown 활성
// BT95 — 벽 정지 (stuckTimer): velocity.x 즉시 반대 방향 큰 속도
if (Mathf.Abs(transform.position.x - _lastX) < stuckMoveThreshold)
{
_stuckTimer += Time.deltaTime;
if (_stuckTimer > stuckThresholdTime)
{
if (control != null) control.velocity = new Vector2(0f, control.velocity.y);
_patrolPhase = (_patrolPhase + 2) % 4;
SetNextPatrolTarget();
if (control != null)
{
control.velocity = new Vector2(-moveDir * control.maxSpeed, control.velocity.y);
control.move.x = -moveDir;
}
_stuckTimer = 0f;
_phaseCooldown = PHASE_COOLDOWN;
_lastX = transform.position.x;
dx = _targetX - transform.position.x;
if (control != null) control.move.x = Mathf.Clamp(dx, -1, 1);
return;
}
}