public void NextScene() { if (currentScene + 1 == SceneConstants.GAME_END) { localPlayer.CmdEndGame(); return; } LoadScene(currentScene + 1); }
public void OnNewTurn(int newTurnsPlayed) // Updated on each client once turnsPlayed changes { turnsPlayed = newTurnsPlayed; if (turnsPlayed % activePlayerCount == 0) { currentRound += 1; } currentPlayer = (turnsPlayed + 1) % activePlayerCount; // Redundantly assign these on each client currentTurnIsPositive = activePlayerCount % 2 == 0 && currentRound % 2 == 0 ? (turnsPlayed + 1) % 2 == 1 : turnsPlayed % 2 == 1; if (currentTurnIsPositive) { storyTagPositiveIter += 1; } else { storyTagNegativeIter += 1; } if (!isActivePlayer) { if (isStoryView) { LoadScene(SceneConstants.STORY_SCREEN, true); // Reload the view every new turn } return; } PrintLogger.printLog("GameManager (client): Next turn; player: " + currentPlayer); if (audioRecorder.recordingsSaved >= 2) { // Trying to end and trim the third recording may crash, so try saving non-trimmed instead audioRecorder.endRecording(false); audioRecorder.saveAllRecordings(); } else { audioRecorder.endRecording(); // Ends any ongoing audio recording audioRecorder.saveAllRecordings(); // Takes a second or two } // Everyone gets to play twice: if (currentRound > maxRounds) { PrintLogger.printLog("GameManager: Ending game (turnsplayed: " + turnsPlayed + ")"); if (isServer) { RpcEndGame(); } else { localPlayer.CmdEndGame(); } return; } PrintLogger.printLog("GameManager: Starting new turn (scene: " + currentScene + ", current player: " + currentPlayer + ", local player: " + localPlayer.ID + ")"); if (currentPlayer == localPlayer.ID) { audioRecorder.startRecording(); LoadScene(SceneConstants.TURN_START); } else { LoadScene(SceneConstants.WAITING_FOR_PLAYERS); } }