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

캐릭터 스탯을 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

@@ -334,13 +334,21 @@ namespace Northbound
return;
int playerAvailableSpace = resourceManager.GetAvailableSpace(playerId);
// 플레이어의 작업량 가져오기
float playerWorkPower = GetPlayerWorkPower(playerId);
int gatheredAmount = Mathf.Min(
resourcesPerGathering,
(int)playerWorkPower,
_currentResources.Value,
playerAvailableSpace
);
if (gatheredAmount <= 0)
{
return;
@@ -411,8 +419,30 @@ namespace Northbound
{
return transform;
}
/// <summary>
/// 플레이어의 작업량 가져오기 (PlayerInteraction.WorkPower)
/// </summary>
private float GetPlayerWorkPower(ulong playerId)
{
// PlayerInteraction 컴포넌트에서 workPower 가져오기
if (NetworkManager.Singleton != null && NetworkManager.Singleton.ConnectedClients.TryGetValue(playerId, out var client))
{
if (client.PlayerObject != null)
{
var playerInteraction = client.PlayerObject.GetComponent<PlayerInteraction>();
if (playerInteraction != null)
{
return playerInteraction.WorkPower;
}
}
}
// 기본값: 10
return 10f;
}
private Worker FindWorkerForPlayer(ulong playerId)
{
if (NetworkManager.Singleton == null || NetworkManager.Singleton.SpawnManager == null)
{