IEnumerator OnJoinedRoom() { loadingIndicator.SetActive(false); GM.moon.SetActive(true); GM.previousScore = 0; //reset team to 0 playerProperties ["t"] = 0; // reset score to 0 playerProperties ["s"] = 0; playerProperties ["hp"] = 100; PhotonNetwork.player.SetCustomProperties(playerProperties); if (loadingIndicator.activeInHierarchy) { loadingIndicator.SetActive(false); } GM.ShowInGameUI(); SpawnPlayer(); if (PhotonNetwork.offlineMode == false) { //Instantiate Powerups if first one in game if (PhotonNetwork.isMasterClient && (bool)PhotonNetwork.room.customProperties ["gs"] == false) { PM.InstantiatePowerups(); } // Assign as Spy if game is already in session if (PhotonNetwork.playerList.Length >= NetworkManager.playersNeededToStartGame && (bool)PhotonNetwork.room.customProperties ["gs"] == true) { // Debug.Log ("Game in session, now a spy"); yield return(new WaitForSeconds(1f)); GL.StartCoroutine(GL.spyPopup(2, false)); } else if (PhotonNetwork.playerList.Length >= NetworkManager.playersNeededToStartGame && (bool)PhotonNetwork.room.customProperties ["gs"] == false) { //Debug.Log("CHOOSE MURDERER CALLED FROM GAMELOOP"); yield return(new WaitForSeconds(1f)); roomProperties ["gs"] = true; roomProperties ["mas"] = true; PhotonNetwork.room.SetCustomProperties(roomProperties); int randomNum = Random.Range(0, PhotonNetwork.playerList.Length); pv.RPC("ChooseRandomMurderer", PhotonTargets.All, randomNum); } // If game has NEVER EVER began --> Show waiting for players blur popup else if (PhotonNetwork.playerList.Length < NetworkManager.playersNeededToStartGame && (bool)PhotonNetwork.room.customProperties ["gs"] == false) { // Debug.Log ("Waiting for players to start"); if (GL.pv.isMine) { GM.ScaleDownInGameUI(); } } } //Single Player ------------------------------------ else if (PhotonNetwork.offlineMode) { SpawnBot("Donald Trump", Random.Range(0, 13)); // SpawnBot ("Harambe", Random.Range(0, 13)); // SpawnBot ("Navjot", Random.Range(0, 13)); // SpawnBot ("Baljot", Random.Range(0, 13)); // SpawnBot ("Harsharn", Random.Range(0, 13)); // SpawnBot ("Manraj", Random.Range(0, 13)); // SpawnBot ("Inderjeet", Random.Range(0, 13)); // SpawnBot ("Avleen", Random.Range(0, 13)); yield return(new WaitForSeconds(0.1f)); int randomNum = Random.Range(0, PhotonNetwork.playerList.Length); pv.RPC("ChooseRandomMurderer", PhotonTargets.All, randomNum); } }