네트워크 멀티플레이 대응
This commit is contained in:
@@ -67,7 +67,7 @@ namespace Northbound
|
||||
{
|
||||
base.OnNetworkSpawn();
|
||||
|
||||
if (IsServer && autoStart)
|
||||
if (IsOwner && autoStart)
|
||||
{
|
||||
StartTimer();
|
||||
}
|
||||
@@ -83,7 +83,7 @@ namespace Northbound
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!IsServer || !_isRunning.Value)
|
||||
if (!IsOwner || !_isRunning.Value)
|
||||
return;
|
||||
|
||||
_currentTime.Value -= Time.deltaTime;
|
||||
@@ -149,7 +149,7 @@ namespace Northbound
|
||||
private void OnCurrentTimeChanged(float previousValue, float newValue)
|
||||
{
|
||||
// 클라이언트에서도 Tick 이벤트 발생
|
||||
if (!IsServer)
|
||||
if (!IsOwner)
|
||||
{
|
||||
OnTimerTick?.Invoke(newValue);
|
||||
}
|
||||
@@ -162,7 +162,7 @@ namespace Northbound
|
||||
/// </summary>
|
||||
public void StartTimer()
|
||||
{
|
||||
if (!IsServer) return;
|
||||
if (!IsOwner) return;
|
||||
|
||||
_currentTime.Value = cycleLength;
|
||||
_isRunning.Value = true;
|
||||
@@ -181,7 +181,7 @@ namespace Northbound
|
||||
/// </summary>
|
||||
public void PauseTimer()
|
||||
{
|
||||
if (!IsServer) return;
|
||||
if (!IsOwner) return;
|
||||
|
||||
_isRunning.Value = false;
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace Northbound
|
||||
/// </summary>
|
||||
public void ResumeTimer()
|
||||
{
|
||||
if (!IsServer) return;
|
||||
if (!IsOwner) return;
|
||||
|
||||
_isRunning.Value = true;
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace Northbound
|
||||
/// </summary>
|
||||
public void ResetTimer()
|
||||
{
|
||||
if (!IsServer) return;
|
||||
if (!IsOwner) return;
|
||||
|
||||
_currentTime.Value = cycleLength;
|
||||
_cycleCount.Value = 0;
|
||||
@@ -255,7 +255,7 @@ namespace Northbound
|
||||
[ClientRpc]
|
||||
private void NotifyCycleCompleteClientRpc()
|
||||
{
|
||||
if (!IsServer)
|
||||
if (!IsOwner)
|
||||
{
|
||||
OnCycleComplete?.Invoke();
|
||||
}
|
||||
@@ -264,7 +264,7 @@ namespace Northbound
|
||||
[ClientRpc]
|
||||
private void NotifyCycleStartClientRpc(int cycleNumber)
|
||||
{
|
||||
if (!IsServer)
|
||||
if (!IsOwner)
|
||||
{
|
||||
OnCycleStart?.Invoke(cycleNumber);
|
||||
}
|
||||
@@ -273,7 +273,7 @@ namespace Northbound
|
||||
[ClientRpc]
|
||||
private void NotifyHalfwayClientRpc()
|
||||
{
|
||||
if (!IsServer)
|
||||
if (!IsOwner)
|
||||
{
|
||||
OnHalfwayPoint?.Invoke(cycleLength / 2f);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user