BT5-Dev #21: vy 조건 폐기·Awake fallback IgnoreCollision·OneWay 디버그 강화
This commit is contained in:
parent
e5eb9ecafb
commit
874f58a66e
|
|
@ -31,10 +31,11 @@ namespace Platformer.Gameplay
|
|||
{
|
||||
if (player == null || player.health == null || enemy == null) return;
|
||||
|
||||
// BT5-Dev #20 — 밟기 영역: Player 발이 Enemy 영역 위 + 하강 중 (점프 후 영역 보장)
|
||||
bool stomped = dyAtCollision > STOMP_MIN_DY && player.velocity.y < 0f;
|
||||
// BT5-Dev #21 — 밟기 영역: Player 발이 Enemy 영역 위 (체공 상승·하강 모두 영역 — vy 조건 폐기)
|
||||
// dy > STOMP_MIN_DY 영역에서 점프 영역 보장됨 (측면 닿음 영역 dy ≈ 0). vy<0 조건은 상승 시점 측면 피격 오인 발동
|
||||
bool stomped = dyAtCollision > STOMP_MIN_DY;
|
||||
|
||||
Debug.Log($"[PEC] stomped={stomped} dy={dyAtCollision:F2} vy={player.velocity.y:F2} (thr>{STOMP_MIN_DY}, vy<0) pInvuln={player.health.IsInvulnerable}");
|
||||
Debug.Log($"[PEC] stomped={stomped} dy={dyAtCollision:F2} vy={player.velocity.y:F2} (thr>{STOMP_MIN_DY}) pInvuln={player.health.IsInvulnerable}");
|
||||
|
||||
if (stomped)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,13 +46,21 @@ namespace Platformer.Mechanics
|
|||
_audio = GetComponent<AudioSource>();
|
||||
spriteRenderer = GetComponent<SpriteRenderer>();
|
||||
|
||||
// PD 지시 2026-05-07 — Player ↔ Enemy 물리 충돌 무시 (통과 가능). 감지는 Bounds.Intersects 별도.
|
||||
// Enemy Collider 일반 유지 (지면 충돌 영역 보존) → 등장 정합.
|
||||
// BT5-Dev #21 — Awake 시점 fallback 추가 (Player tag 영역 미설정 영역 대비)
|
||||
var playerObj = GameObject.FindGameObjectWithTag("Player");
|
||||
if (playerObj == null)
|
||||
{
|
||||
var pcfb = Object.FindFirstObjectByType<PlayerController>();
|
||||
if (pcfb != null) playerObj = pcfb.gameObject;
|
||||
}
|
||||
if (playerObj != null && _collider != null)
|
||||
{
|
||||
var pc = playerObj.GetComponent<Collider2D>();
|
||||
if (pc != null) Physics2D.IgnoreCollision(_collider, pc, true);
|
||||
if (pc != null)
|
||||
{
|
||||
Physics2D.IgnoreCollision(_collider, pc, true);
|
||||
_ignoreCollisionApplied = true;
|
||||
}
|
||||
}
|
||||
|
||||
// BT5-Dev #17 marker — 본 영역 출력 시 새 코드 영역 적용 정합. 출력 X = Editor Asset Refresh 영역 미수행
|
||||
|
|
|
|||
|
|
@ -25,18 +25,24 @@ namespace Platformer.Mechanics
|
|||
static void SetupOneWayPlatforms()
|
||||
{
|
||||
int applied = 0;
|
||||
int excludedTrigger = 0, excludedActor = 0;
|
||||
var allColliders = Object.FindObjectsByType<Collider2D>(FindObjectsSortMode.None);
|
||||
var appliedNames = new System.Collections.Generic.List<string>();
|
||||
var excludedNames = new System.Collections.Generic.List<string>();
|
||||
foreach (var c in allColliders)
|
||||
{
|
||||
if (c == null) continue;
|
||||
if (c.isTrigger) continue;
|
||||
// Player·Enemy·기타 GameObject 영역 제외
|
||||
if (c.GetComponent<PlayerController>() != null) continue;
|
||||
if (c.GetComponent<EnemyController>() != null) continue;
|
||||
if (c.GetComponent<DeathZone>() != null) continue;
|
||||
if (c.GetComponent<TokenInstance>() != null) continue;
|
||||
if (c.GetComponent<VictoryZone>() != null) continue;
|
||||
if (c.GetComponent<AttackHitbox>() != null) continue;
|
||||
if (c.isTrigger) { excludedTrigger++; continue; }
|
||||
if (c.GetComponent<PlayerController>() != null
|
||||
|| c.GetComponent<EnemyController>() != null
|
||||
|| c.GetComponent<DeathZone>() != null
|
||||
|| c.GetComponent<TokenInstance>() != null
|
||||
|| c.GetComponent<VictoryZone>() != null
|
||||
|| c.GetComponent<AttackHitbox>() != null)
|
||||
{
|
||||
excludedActor++;
|
||||
continue;
|
||||
}
|
||||
|
||||
c.usedByEffector = true;
|
||||
var effector = c.GetComponent<PlatformEffector2D>();
|
||||
|
|
@ -47,8 +53,10 @@ namespace Platformer.Mechanics
|
|||
effector.useSideFriction = false;
|
||||
effector.useSideBounce = false;
|
||||
applied++;
|
||||
if (appliedNames.Count < 8) appliedNames.Add($"{c.gameObject.name}({c.GetType().Name})");
|
||||
}
|
||||
Debug.Log($"[BT19-OneWay] applied={applied} totalColliders={allColliders.Length}");
|
||||
Debug.Log($"[BT21-OneWay] applied={applied} trigger={excludedTrigger} actor={excludedActor} total={allColliders.Length}");
|
||||
Debug.Log($"[BT21-OneWay] appliedSamples=[{string.Join(", ", appliedNames)}]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue