BT5-Dev #66: R2 채택 — AutoForeground GameObject 신규·자동 분류 분리 (PD 명시 채택)

PD 명시 (2026-05-08): "R2로 진행해줘"

근본 원인 (BT65 진단):
- 본 PM 자동 분류 코드(BT47/BT48)가 PD 시각 분리 의도 침범
- PD Foreground = 직접 그린 가림막 시각만 + 본 PM 자동 분류 발판이 같은 GameObject 영역 혼재

R2 변경 (BT63 영역 + 분리):
1. PD Foreground GameObject = 가림막 시각만 (TilemapCollider2D Object.Destroy)
   - PD 직접 그린 Tile 그대로·시각 표시 보존
   - Player와 충돌 X (PD 시각 의도 정합)
2. AutoForeground GameObject 신규 생성 (Grid 자식)
   - Tilemap + TilemapRenderer + TilemapCollider2D 자동 부착
   - Layer 16 (Drop-Through)
   - 자동 분류(BT47/BT48 임계값+작은 발판) SetTile 대상
3. PlayerController.UpdateContactFilterForDropThrough 영역 그대로 (Layer 16 mask 동적·BT63 영역 보존)

효과:
- PD 가림막 = 시각 표시·Player 통과 가능 (PD 의도 정합)
- 자동 분류 발판 = AutoForeground 영역·Drop-Through 패턴 (위 착지 + ascending 통과)
- BT49 None 차단 그대로 (tree·plant·fence·house 자체 통과)

매 Play 시점 동작:
- PD Foreground TilemapCollider Destroy
- AutoForeground 검색·없으면 신규 생성·Grid 자식·필수 컴포넌트 자동 부착
- 자동 분류 영역(BT48 임계값+작은 발판) Level → AutoForeground SetTile

후속 의무:
- PD Refresh+Play 시각 검증
- 본 PM Editor.log [BT48-MoveTiles] direct read
- 정합 시 BT49~BT65 영구 폐기 + feedback 메모리 등재
This commit is contained in:
깃 관리자 2026-05-08 00:10:30 +09:00
parent dba99d21dc
commit 32fa2d4b07
1 changed files with 31 additions and 8 deletions

View File

@ -68,17 +68,40 @@ namespace Platformer.Mechanics
if (appliedNames.Count < 8) appliedNames.Add($"{c.gameObject.name}({c.GetType().Name})");
}
// BT47 — Foreground TilemapCollider2D + Layer 16 (ColliderType Sprite 강제는 Tile 이동 후 한 번에 처리)
// BT65 — PD 명시 (2026-05-08): "직전 상태로 되돌려" = BT64 폐기 → BT63 회귀.
var foreground = GameObject.Find("Foreground");
// BT66 — PD 결정 R2 (2026-05-08): 자동 분류 결과 = 별도 GameObject (AutoForeground).
// PD Foreground GameObject = PD 직접 그린 가림막 시각만 (TilemapCollider 제거).
// AutoForeground GameObject (신규·Grid 자식) = 본 PM 자동 분류 발판 + TilemapCollider + Layer 16 + Drop-Through.
// 결과: PD 시각 의도 (가림막 영역) 분리 + 자동 분류 발판 영역 별도 + Drop-Through 패턴 작동.
// 1. PD Foreground = 가림막 시각만. 기존 TilemapCollider2D 제거 (충돌 X).
var pdForeground = GameObject.Find("Foreground");
if (pdForeground != null)
{
var pdFgTc = pdForeground.GetComponent<UnityEngine.Tilemaps.TilemapCollider2D>();
if (pdFgTc != null) Object.Destroy(pdFgTc);
}
// 2. AutoForeground GameObject 신규 생성 (Grid 자식) — 자동 분류 발판 전용.
GameObject gridGo = (pdForeground != null && pdForeground.transform.parent != null)
? pdForeground.transform.parent.gameObject
: GameObject.Find("Grid");
GameObject autoFg = GameObject.Find("AutoForeground");
UnityEngine.Tilemaps.Tilemap fgTilemap = null;
UnityEngine.Tilemaps.TilemapCollider2D fgTc = null;
if (foreground != null)
if (autoFg == null && gridGo != null)
{
fgTc = foreground.GetComponent<UnityEngine.Tilemaps.TilemapCollider2D>();
if (fgTc == null) fgTc = foreground.AddComponent<UnityEngine.Tilemaps.TilemapCollider2D>();
foreground.layer = 16;
fgTilemap = foreground.GetComponent<UnityEngine.Tilemaps.Tilemap>();
autoFg = new GameObject("AutoForeground");
autoFg.transform.SetParent(gridGo.transform, false);
}
if (autoFg != null)
{
autoFg.layer = 16;
fgTilemap = autoFg.GetComponent<UnityEngine.Tilemaps.Tilemap>();
if (fgTilemap == null) fgTilemap = autoFg.AddComponent<UnityEngine.Tilemaps.Tilemap>();
if (autoFg.GetComponent<UnityEngine.Tilemaps.TilemapRenderer>() == null)
autoFg.AddComponent<UnityEngine.Tilemaps.TilemapRenderer>();
fgTc = autoFg.GetComponent<UnityEngine.Tilemaps.TilemapCollider2D>();
if (fgTc == null) fgTc = autoFg.AddComponent<UnityEngine.Tilemaps.TilemapCollider2D>();
}
// BT48 — Level → Foreground 자동 분류 강화. 분류 조건 2종 결합: