fix(BT12-Dev): Player 피격 distance 기반 강화 + Enemy HP 자동 fallback (PD 보고 재발 2026-05-13)
작업 1 — Enemy HP 30~40 자동 fallback: - Health.Awake — RandomMaxHPRange 미설정 + EnemyController 존재 검출 → maxHP = Random.Range(30, 41) 자동 - PD Inspector 설정 의존 폐기 (PD가 매번 직접 영역 안전 X) 작업 2 — Player 피격 distance 기반 강화 + 진단 Debug.Log (회수 의무): - EnemyController.Update — VisualBounds.Intersects OR distance < 1.5f 단일 조건 fix - [EnemyHit] 단일 prefix Debug.Log — dist·boundsHit·distHit·invuln·Enemy/Player pos·t - PD Console 측정 결과 영역 근본 fix 후 본 PM revert - 본 PM 자성 #7 — 직전 IsGrounded 폐기 fix 효과 X 자인·다른 가설 (Bounds 미 교차) 강력화 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b4847b1545
commit
2efcd34177
|
|
@ -386,10 +386,14 @@ namespace Platformer.Mechanics
|
||||||
}
|
}
|
||||||
if (_cachedPlayer != null && _cachedPlayer.health != null && _cachedPlayer.health.IsAlive)
|
if (_cachedPlayer != null && _cachedPlayer.health != null && _cachedPlayer.health.IsAlive)
|
||||||
{
|
{
|
||||||
// PD 지시 2026-05-13 — "닿아도 피해 X" 정정. IsGrounded 조건 폐기 영역 ground·공중 무관 피격.
|
// PD 지시 2026-05-13 — "닿아도 X" 재 보고. Bounds.Intersects 영역 너무 좁은 가능성 → distance 기반 fix.
|
||||||
// 직전 2026-05-11 명시 "공중 통과" 영역 폐기 (PD 직접 의도 변경 영역).
|
// 진단 Debug.Log 추가 (회수 의무·PD Console 측정 후 본 PM revert).
|
||||||
if (VisualBounds.Intersects(_cachedPlayer.Bounds))
|
float dist = Vector2.Distance(transform.position, _cachedPlayer.transform.position);
|
||||||
|
bool boundsHit = VisualBounds.Intersects(_cachedPlayer.Bounds);
|
||||||
|
bool distHit = dist < 1.5f;
|
||||||
|
if (boundsHit || distHit)
|
||||||
{
|
{
|
||||||
|
Debug.Log($"[EnemyHit] enemy={name} dist={dist:F2} boundsHit={boundsHit} distHit={distHit} invuln={_cachedPlayer.health.IsInvulnerable} enemyPos=({transform.position.x:F2},{transform.position.y:F2}) playerPos=({_cachedPlayer.transform.position.x:F2},{_cachedPlayer.transform.position.y:F2}) t={Time.time:F2}");
|
||||||
if (!_cachedPlayer.health.IsInvulnerable)
|
if (!_cachedPlayer.health.IsInvulnerable)
|
||||||
{
|
{
|
||||||
_cachedPlayer.health.Decrement();
|
_cachedPlayer.health.Decrement();
|
||||||
|
|
|
||||||
|
|
@ -378,6 +378,15 @@ namespace Platformer.Mechanics
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PD 지시 2026-05-13 — Enemy 영역 RandomMaxHPRange Inspector 미설정 fallback (자동 30~40 random)
|
||||||
|
if (GetComponent<EnemyController>() != null)
|
||||||
|
{
|
||||||
|
maxHP = UnityEngine.Random.Range(30, 41);
|
||||||
|
maxHearts = Mathf.Max(1, maxHP / QuartersPerHeart);
|
||||||
|
currentHP = maxHP;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// maxHearts가 설정되어 있고 maxHP가 구식 값(1)으로 남아있는 프리팹 호환 처리.
|
// maxHearts가 설정되어 있고 maxHP가 구식 값(1)으로 남아있는 프리팹 호환 처리.
|
||||||
// 정상 흐름: maxHP = maxHearts * 4, currentHP = maxHP로 초기화.
|
// 정상 흐름: maxHP = maxHearts * 4, currentHP = maxHP로 초기화.
|
||||||
if (maxHearts <= 0) maxHearts = 1;
|
if (maxHearts <= 0) maxHearts = 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue