아이템 드랍 및 인벤토리 기능 구현

This commit is contained in:
2026-01-17 15:58:42 +09:00
parent 616120b7c5
commit 443942f6ca
21 changed files with 589 additions and 15 deletions

View File

@@ -0,0 +1,23 @@
using Unity.Netcode;
using UnityEngine;
using System.Collections.Generic;
public class PlayerInventory : NetworkBehaviour
{
// 아이템 이름과 개수를 저장
private Dictionary<string, int> items = new Dictionary<string, int>();
public void AddItem(ItemData data)
{
if (!IsServer) return;
if (items.ContainsKey(data.itemName))
items[data.itemName]++;
else
items.Add(data.itemName, 1);
Debug.Log($"[Inventory] {data.itemName} 획득! (현재: {items[data.itemName]}개)");
// 여기서 클라이언트 UI를 갱신하는 ClientRpc를 호출할 수 있습니다.
}
}