From db56c69dd963d4ed885fbed4492eed1b4cb271c8 Mon Sep 17 00:00:00 2001 From: Fangh Date: Thu, 1 Feb 2024 22:57:10 +0100 Subject: [PATCH] feat: cannot play under 3 players --- Assets/Scripts/GameManager.cs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index be02ebd..93d919e 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -317,11 +317,13 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e) { case (int)GameState.WaitingForOtherPlayersToJoin: { - if(CheckIfIAmTheFirst(myRoom.GetPlayerList())) + List players = myRoom.GetOrderedPlayerList(); + UpdateDisplayedListUser(players); + + if (players.Count >= 3 && CheckIfIAmTheFirst(players)) { submitStartGame.SetActive(true); } - UpdateDisplayedListUser(myRoom.GetOrderedPlayerList()); break; } default: @@ -509,13 +511,18 @@ private void OnCurrentQuestionChanged(object sender, ValueChangedEventArgs onlin Question q = myRoom.questions[questionId]; - if (WaitingOtherPlayers.activeInHierarchy) + //do not vote for your question + if(myRoom.GetQuestionsByPlayer(currentPlayer).Contains(q)) { - WaitingOtherPlayers.SetActive(false); - VotePicture.SetActive(true); + WaitingOtherPlayers.SetActive(true); + VotePicture.SetActive(false); + } + else + { + VotePicture.SetActive(true); + WaitingOtherPlayers.SetActive(false); + VotePicture.GetComponent().ShowQuestion(q); } - VotePicture.GetComponent().ShowQuestion(q); - } ///