2026-06-01 씬전환시 무기 사라지는 현상 수정
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user