fix(BT12-Dev): 박쥐 IsFlying Animator name 자동 감지 (PD 진단 2026-05-15)

PD 추가 보고 + 스크린샷: "여전히 박쥐 몬스터가 공중에 떠있지 않고
움직이지도 않아"

진단 결과: Enemy.prefab 영역 MonsterRandomizer 부착 X · Animator
직접 M002.overrideController 부착. 직전 commit 6be8ccd 의
MonsterRandomizer flyingFlags / name fallback 영역 발화 X →
IsFlying=False 잔존 → gravity·collide 정상 적용 → 박쥐 지상 정지.

정정:
- EnemyController.Awake 영역 Animator.runtimeAnimatorController.name
  "M002" 포함 시 IsFlying=true 자동 set
- 기존 MonsterRandomizer name fallback 도 보존 (랜덤 케이스 대비)

검증 (Play 모드):
- Enemy 16기 중 박쥐 3기 모두 IsFlying=True·ignoreCollisions=True·
  gravMod=0 자동 set
- 1기 velocity=(-3.50, 0) patrol 이동 중·2~3기 wait 상태 정합

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
깃 관리자 2026-05-15 00:31:55 +09:00
parent 6be8ccd567
commit 60c2e9bf09
2 changed files with 19 additions and 2 deletions

View File

@ -105,6 +105,18 @@ namespace Platformer.Mechanics
// Layer 14 (Enemy) ↔ Layer 14 collide X·전역 1회 적용 (Awake 영역 매번 호출 무관·idempotent). // Layer 14 (Enemy) ↔ Layer 14 collide X·전역 1회 적용 (Awake 영역 매번 호출 무관·idempotent).
Physics2D.IgnoreLayerCollision(14, 14, true); Physics2D.IgnoreLayerCollision(14, 14, true);
// PD 지시 2026-05-15 — Animator.runtimeAnimatorController name 영역 M002 (박쥐) 영역 IsFlying=true 자동
// (MonsterRandomizer 부재·Animator 직접 controller 부착 케이스 보강)
if (!IsFlying)
{
var anim = GetComponent<Animator>();
if (anim != null && anim.runtimeAnimatorController != null
&& anim.runtimeAnimatorController.name.Contains("M002"))
{
IsFlying = true;
}
}
// PD 지시 2026-05-15 — 날으는 몬스터 영역 중력 무효 + collide 무시 (이동 정합) // PD 지시 2026-05-15 — 날으는 몬스터 영역 중력 무효 + collide 무시 (이동 정합)
if (IsFlying && control != null) if (IsFlying && control != null)
{ {

View File

@ -26,10 +26,15 @@ namespace Platformer.Mechanics
var anim = GetComponent<Animator>(); var anim = GetComponent<Animator>();
if (anim == null) return; if (anim == null) return;
int idx = Random.Range(0, overrideControllers.Length); int idx = Random.Range(0, overrideControllers.Length);
anim.runtimeAnimatorController = overrideControllers[idx]; var selected = overrideControllers[idx];
anim.runtimeAnimatorController = selected;
// PD 지시 2026-05-15 — 박쥐 선택 시 EnemyController.IsFlying=true 자동 set // PD 지시 2026-05-15 — 박쥐 선택 시 EnemyController.IsFlying=true 자동 set
if (flyingFlags != null && idx < flyingFlags.Length && flyingFlags[idx]) // flyingFlags Inspector 설정 우선 · 미설정 시 controller name fallback (M002 = 박쥐)
bool isFlying = false;
if (flyingFlags != null && idx < flyingFlags.Length && flyingFlags[idx]) isFlying = true;
else if (selected != null && selected.name.Contains("M002")) isFlying = true;
if (isFlying)
{ {
var ec = GetComponent<EnemyController>(); var ec = GetComponent<EnemyController>();
if (ec != null) ec.IsFlying = true; if (ec != null) ec.IsFlying = true;