diff --git a/Assets/Scenes/Ingame.unity b/Assets/Scenes/Ingame.unity index de4c21a..2531ba3 100644 --- a/Assets/Scenes/Ingame.unity +++ b/Assets/Scenes/Ingame.unity @@ -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 diff --git a/Assets/Scripts/Mechanics/EnemyController.cs b/Assets/Scripts/Mechanics/EnemyController.cs index dfb53a4..c0109e2 100644 --- a/Assets/Scripts/Mechanics/EnemyController.cs +++ b/Assets/Scripts/Mechanics/EnemyController.cs @@ -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; } }