public void RoomChosen(int room, UIHandlerChatScene UI) { informationSwitch = GameObject.Find("Image").GetComponent <InformationSwitch>(); this.UI = UI; this.room = room; status = 1; // players started the game informationSwitch.waitingForPlayer(); AddNewHighscore(selfIdentification, status, room); DownloadHighscores(); StartCoroutine(CheckForOtherPlayer(1)); }
private IEnumerator CheckIfBothEnteredGame() { int statusCase = 3; yield return(new WaitForSeconds(5f)); // string playerLink = channelName + separatingStrings[0] + otherPlayer.ID; // GetSingleEntry(playerLink); informationFound = false; DownloadHighscores(); while (!informationFound) { yield return(new WaitForSeconds(1f)); } if (otherPlayer.status < statusCase) { SceneManager.LoadScene("ChooseRoomScene", LoadSceneMode.Single); yield return(new WaitForSeconds(0.5f)); informationSwitch = GameObject.Find("Image").GetComponent <InformationSwitch>(); informationSwitch.otherPlayerIsNotInGame(); StartCoroutine(AboardRoomSelection()); } else if (otherPlayer.status == 4) { GameLost(); SceneManager.LoadScene("LooseScene"); } else if (otherPlayer.status > 4) { GameFinished(); SceneManager.LoadScene("WinScene"); } else { CheckStatusOfOtherPlayerDuringGame(); } // if(room == 1) // just for testing, delete later // { // yield return new WaitForSeconds(1f); // User.finishTime = UnityEngine.Random.Range(200, 1800); // // User.finishTime = 802; // GameFinished(); // // SceneManager.LoadScene("Highscore"); // // SceneManager.LoadScene("LooseScene"); // SceneManager.LoadScene("WinScene"); // } }