From 32fa2d4b079187681797d310ff1e32ce282d0a87 Mon Sep 17 00:00:00 2001 From: swrring Date: Fri, 8 May 2026 00:10:30 +0900 Subject: [PATCH] =?UTF-8?q?BT5-Dev=20#66:=20R2=20=EC=B1=84=ED=83=9D=20?= =?UTF-8?q?=E2=80=94=20AutoForeground=20GameObject=20=EC=8B=A0=EA=B7=9C?= =?UTF-8?q?=C2=B7=EC=9E=90=EB=8F=99=20=EB=B6=84=EB=A5=98=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC=20(PD=20=EB=AA=85=EC=8B=9C=20=EC=B1=84=ED=83=9D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 메모리 등재 --- Assets/Scripts/Mechanics/GameOptimizer.cs | 39 ++++++++++++++++++----- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/Assets/Scripts/Mechanics/GameOptimizer.cs b/Assets/Scripts/Mechanics/GameOptimizer.cs index 2758419..2778352 100644 --- a/Assets/Scripts/Mechanics/GameOptimizer.cs +++ b/Assets/Scripts/Mechanics/GameOptimizer.cs @@ -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(); + 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(); - if (fgTc == null) fgTc = foreground.AddComponent(); - foreground.layer = 16; - fgTilemap = foreground.GetComponent(); + autoFg = new GameObject("AutoForeground"); + autoFg.transform.SetParent(gridGo.transform, false); + } + if (autoFg != null) + { + autoFg.layer = 16; + fgTilemap = autoFg.GetComponent(); + if (fgTilemap == null) fgTilemap = autoFg.AddComponent(); + if (autoFg.GetComponent() == null) + autoFg.AddComponent(); + fgTc = autoFg.GetComponent(); + if (fgTc == null) fgTc = autoFg.AddComponent(); } // BT48 — Level → Foreground 자동 분류 강화. 분류 조건 2종 결합: