사망 시 사망 UI 출력
This commit is contained in:
@@ -52,6 +52,7 @@ public class NetworkPlayerController : NetworkBehaviour, ITeamMember, IDamageabl
|
||||
private NetworkAnimator _networkAnimator;
|
||||
private PlayerStats _playerStats;
|
||||
private UnitHealthBar _healthBar;
|
||||
private RespawnCountdownUI _respawnCountdownUI;
|
||||
|
||||
// 이 플레이어가 로컬 플레이어인지 확인
|
||||
|
||||
@@ -93,6 +94,12 @@ public class NetworkPlayerController : NetworkBehaviour, ITeamMember, IDamageabl
|
||||
_currentHealth.OnValueChanged += OnHealthChanged;
|
||||
_ownerPlayerId.OnValueChanged += OnOwnerPlayerIdChanged;
|
||||
|
||||
// 로컬 플레이어만 씬에서 리스폰 UI 찾기
|
||||
if (IsLocalPlayer)
|
||||
{
|
||||
_respawnCountdownUI = FindFirstObjectByType<RespawnCountdownUI>();
|
||||
}
|
||||
|
||||
// 체력바 생성
|
||||
if (showHealthBar && healthBarPrefab != null)
|
||||
{
|
||||
@@ -107,6 +114,12 @@ public class NetworkPlayerController : NetworkBehaviour, ITeamMember, IDamageabl
|
||||
{
|
||||
OnOwnerChanged?.Invoke(newValue);
|
||||
TryInitializeLocalPlayer();
|
||||
|
||||
// 로컬 플레이어가 되면 리스폰 UI 참조 가져오기
|
||||
if (IsLocalPlayer && _respawnCountdownUI == null)
|
||||
{
|
||||
_respawnCountdownUI = FindFirstObjectByType<RespawnCountdownUI>();
|
||||
}
|
||||
}
|
||||
|
||||
private void TryInitializeLocalPlayer()
|
||||
@@ -341,10 +354,20 @@ public class NetworkPlayerController : NetworkBehaviour, ITeamMember, IDamageabl
|
||||
[ClientRpc]
|
||||
private void HidePlayerClientRpc()
|
||||
{
|
||||
// 로컬 플레이어만 입력 비활성화
|
||||
if (IsLocalPlayer && _inputActions != null)
|
||||
// 로컬 플레이어만 입력 비활성화 및 UI 표시
|
||||
if (IsLocalPlayer)
|
||||
{
|
||||
_inputActions.Disable();
|
||||
if (_inputActions != null)
|
||||
{
|
||||
_inputActions.Disable();
|
||||
}
|
||||
|
||||
// 리스폰 카운트다운 UI 표시
|
||||
if (_respawnCountdownUI != null)
|
||||
{
|
||||
double endServerTime = NetworkManager.Singleton.ServerTime.Time + respawnDelay;
|
||||
_respawnCountdownUI.Show(endServerTime, respawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
// CharacterController 비활성화 (이동 및 충돌 방지)
|
||||
@@ -367,10 +390,19 @@ public class NetworkPlayerController : NetworkBehaviour, ITeamMember, IDamageabl
|
||||
[ClientRpc]
|
||||
private void ShowPlayerClientRpc()
|
||||
{
|
||||
// 로컬 플레이어만 입력 활성화
|
||||
if (IsLocalPlayer && _inputActions != null)
|
||||
// 로컬 플레이어만 입력 활성화 및 UI 숨김
|
||||
if (IsLocalPlayer)
|
||||
{
|
||||
_inputActions.Enable();
|
||||
if (_inputActions != null)
|
||||
{
|
||||
_inputActions.Enable();
|
||||
}
|
||||
|
||||
// 리스폰 카운트다운 UI 숨김
|
||||
if (_respawnCountdownUI != null)
|
||||
{
|
||||
_respawnCountdownUI.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
// CharacterController 활성화
|
||||
|
||||
Reference in New Issue
Block a user