업그레이드 데이터 입력 로직 및 기능 추가

캐릭터 스탯을 PlayerStats 컴포넌트에서 모아서 관리하도록 변경
코드에서도 마찬가지
This commit is contained in:
2026-02-23 00:21:44 +09:00
parent b34254137f
commit cc475bce3e
54 changed files with 1402 additions and 98 deletions

View File

@@ -5,13 +5,13 @@ namespace Northbound
{
public class PlayerResourceInventory : NetworkBehaviour
{
public int maxResourceCapacity = 100;
private int _displayAmount = 0;
public int CurrentResourceAmount => _displayAmount;
public int MaxResourceCapacity => maxResourceCapacity;
public int MaxResourceCapacity => _playerStats?.GetCapacity() ?? 100;
private NetworkPlayerController _networkPlayerController;
private PlayerStats _playerStats;
private bool IsLocalPlayer => _networkPlayerController != null && _networkPlayerController.IsLocalPlayer;
private ulong LocalPlayerId => _networkPlayerController != null ? _networkPlayerController.OwnerPlayerId : OwnerClientId;
@@ -19,6 +19,7 @@ namespace Northbound
private void Awake()
{
_networkPlayerController = GetComponent<NetworkPlayerController>();
_playerStats = GetComponent<PlayerStats>();
}
[Rpc(SendTo.Server)]
@@ -33,7 +34,6 @@ namespace Northbound
public override void OnNetworkSpawn()
{
// _ownerPlayerId 변경 이벤트 구독
if (_networkPlayerController != null)
{
_networkPlayerController.OnOwnerChanged += OnOwnerPlayerIdChanged;
@@ -50,8 +50,8 @@ namespace Northbound
private void TryInitialize()
{
if (!IsLocalPlayer) return;
SetMaxCapacityServerRpc(maxResourceCapacity, LocalPlayerId);
SetMaxCapacityServerRpc(MaxResourceCapacity, LocalPlayerId);
RequestResourceUpdateServerRpc(LocalPlayerId);
}