// Server-side: Game was won between two clients (no bot) // Find the client that won and tell everyone protected void WinGameOnServer(PaddleWinState winState) { unspawnObjects(); ulong winnerClientId = 0; bool hasWinner = true; switch (winState) { case PaddleWinState.LeftWon: winnerClientId = leftPaddle.OwnerClientId; break; case PaddleWinState.RightWon: winnerClientId = rightPaddle.OwnerClientId; break; case PaddleWinState.Tie: hasWinner = false; break; } // Update connectedPlayerScores on network if (hasWinner) { network.connectedPlayerScores[winnerClientId]++; } InvokeClientRpcOnEveryone(WinGameOnClient, hasWinner, winnerClientId); }
public void WinVsBotOnClient(PaddleWinState winState) { switch (winState) { case PaddleWinState.LeftWon: canvas.showVictoryPanel(GameWinState.Win); break; case PaddleWinState.RightWon: canvas.showVictoryPanel(GameWinState.Loss); break; case PaddleWinState.Tie: canvas.showVictoryPanel(GameWinState.Tie); break; } }
// Server-side: game was won against a bot (one player, one bot) protected void WinVsBotOnServer(PaddleWinState winState) { unspawnObjects(); InvokeClientRpcOnEveryone(WinVsBotOnClient, winState); }