// Use this for initialization void Start() { netManagerHUD = GameObject.Find("LobbyManager").GetComponent <RG_NetworkManagerHUD> (); netLobbyManager = GameObject.Find("LobbyManager").GetComponent <RG_NetworkLobbyManager> (); netId = GetComponent <NetworkIdentity> (); slot = GetComponent <NetworkLobbyPlayer> ().slot; vehicleNumber = PlayerPrefs.GetInt("Vehicle Number", 0); if (netId.isLocalPlayer) { CmdVehicleNumber(vehicleNumber); netLobbyManager.SetPlayerTypeLobby(slot, vehicleNumber); isLocalPlayer = true; PlayerPrefs.SetInt("Slot", slot); } else { isLocalPlayer = false; } if (slot == 0 && netId.isLocalPlayer) { //This player is host GameObject.Find("LobbyManager").GetComponent <RG_NetworkManagerHUD>().EnableStartLobbyGameButton(); GameObject.Find("Start Lobby Game Button").GetComponent <Button> ().onClick = buttonCallback; } if (slot == 0) { transform.name = "Player " + slot.ToString() + (" (HOST)"); } else { if (isLocalPlayer) { SetStartFlag(); } transform.name = "Player " + slot.ToString(); // } }
public void LoadGarageButton() { if (Application.isPlaying) { if (audioData.music.Length > 0) { if (!raceMusicAudioSource.isPlaying) { PlayNextAudioTrack(); } } } if (gameMode == "MULTIPLAYER") { RG_NetworkManagerHUD networkManagerHUD = GameObject.Find("LobbyManager").GetComponent <RG_NetworkManagerHUD> (); networkManagerHUD.Button_BackLobby(); // if (lobbyHUDReference.startGameButton.activeInHierarchy) { // networkLobbyManager.matchMaker.DestroyMatch ((NetworkID)networkLobbyManager.matchInfo.networkId, OnDestroyMatch); // networkLobbyManager.StopHost(); // networkLobbyManager.StopMatchMaker(); // Debug.Log ("Destroy Match"); // } else { // networkLobbyManager.StopClient(); // networkLobbyManager.StopMatchMaker(); // Debug.Log ("Leave Match"); // } } else { SceneManager.LoadScene("Garage"); } //DestroyImmediate (GameObject.Find ("LobbyManager")); }