2026-06-01 씬전환시 무기 사라지는 현상 수정

This commit is contained in:
2026-06-01 13:06:31 +09:00
parent 964383c59c
commit 11a6a4f983
7 changed files with 67 additions and 13 deletions

View File

@@ -43,13 +43,16 @@ private void ApplyVisual()
}
// 플레이어가 트리거 영역에 진입 시 발화.
// Player(또는 자식)에 PlayerWeaponInventory 컴포넌트가 있어야 픽업 됨.
// 인벤토리는 영속 싱글톤(PlayerWeaponInventory.Instance)이므로 Player 본인이 들어왔는지만 확인.
// 이미 보유 중이면 Pickup이 false 반환 → pickup 오브젝트 그대로 유지.
private void OnTriggerEnter2D(Collider2D other)
{
if (_weapon == null) return;
PlayerWeaponInventory inventory = other.GetComponentInParent<PlayerWeaponInventory>();
// 플레이어 본인만 픽업 (적/투사체 등이 트리거 들어와도 무시).
if (other.GetComponentInParent<PlayerController>() == null) return;
PlayerWeaponInventory inventory = PlayerWeaponInventory.Instance;
if (inventory == null) return;
if (inventory.Pickup(_weapon))