Added map and fixed other bugs
This commit is contained in:
@@ -66,6 +66,10 @@ public class RoundManager : NetworkBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// Рестарт матча по R — любой игрок, запрос уходит на сервер
|
||||
if (Input.GetKeyDown(KeyCode.R))
|
||||
RequestRestartServerRpc();
|
||||
|
||||
if (!IsServer) return;
|
||||
if (!IsRoundActive) return;
|
||||
|
||||
@@ -126,6 +130,41 @@ public class RoundManager : NetworkBehaviour
|
||||
// }
|
||||
}
|
||||
|
||||
[Rpc(SendTo.Server, InvokePermission = RpcInvokePermission.Everyone)]
|
||||
private void RequestRestartServerRpc()
|
||||
{
|
||||
RestartMatch();
|
||||
}
|
||||
|
||||
// Полный рестарт: стоп текущего раунда и клонов, очистка архива и счёта, раунд с нуля
|
||||
private void RestartMatch()
|
||||
{
|
||||
if (!IsServer) return;
|
||||
|
||||
StopAllCoroutines();
|
||||
|
||||
if (GhostRoundManager.Current != null)
|
||||
{
|
||||
GhostRoundManager.Current.ServerEndRound();
|
||||
GhostRoundManager.Current.ClearArchive();
|
||||
}
|
||||
|
||||
for (int _i = 0; _i < playerScores.Count; _i++)
|
||||
{
|
||||
playerScores[_i] = new PlayerScore
|
||||
{
|
||||
ClientId = playerScores[_i].ClientId,
|
||||
Score = 0
|
||||
};
|
||||
}
|
||||
|
||||
isRoundActive.Value = false;
|
||||
roundTimeRemaining.Value = 0f;
|
||||
currentRound.Value = 0;
|
||||
|
||||
StartCoroutine(StartRoundWithDelay());
|
||||
}
|
||||
|
||||
public void RegisterPlayer(ulong _clientId)
|
||||
{
|
||||
if (!IsServer) return;
|
||||
|
||||
Reference in New Issue
Block a user