/// <summary> /// Spawn Player Function /// </summary> /// <param name="t_team"></param> public void SpawnPlayer(Team t_team) { if (!bl_RoomMenu.Instance.SpectatorMode) { if (OurPlayer != null) { PhotonNetwork.Destroy(OurPlayer); } if (!GameFinish) { Hashtable PlayerTeam = new Hashtable(); PlayerTeam.Add(PropertiesKeys.TeamKey, t_team.ToString()); PhotonNetwork.LocalPlayer.SetCustomProperties(PlayerTeam, null); LocalPlayerTeam = t_team; //spawn the player model #if !PSELECTOR SpawnPlayerModel(t_team); m_RoomCamera.gameObject.SetActive(false); StartCoroutine(bl_UIReferences.Instance.FinalFade(false, false, 0)); bl_UtilityHelper.LockCursor(true); if (!Joined) { StartPlayTime = Time.time; } Joined = true; #if UMM MiniMapCanvas.enabled = true; #endif #else bl_PlayerSelector ps = FindObjectOfType <bl_PlayerSelector>(); if (ps.IsSelected && !ps.isChangeOfTeam) { ps.SpawnSelected(); } else { ps.OpenSelection(t_team); } #endif } else { m_RoomCamera.gameObject.SetActive(true); } } else { this.GetComponent <bl_RoomMenu>().WaitForSpectator = true; } }
/// <summary> /// Spawn Player Function /// </summary> /// <param name="t_team"></param> public void SpawnPlayer(Team t_team) { if (!this.GetComponent <bl_RoomMenu>().SpectatorMode) { if (OurPlayer != null) { PhotonNetwork.Destroy(OurPlayer); } if (!GameFinish) { Hashtable PlayerTeam = new Hashtable(); PlayerTeam.Add(PropertiesKeys.TeamKey, t_team.ToString()); PhotonNetwork.player.SetCustomProperties(PlayerTeam, null, true); //spawn the player model #if !PSELECTOR SpawnPlayerModel(t_team); Chat.Refresh(); m_RoomCamera.gameObject.SetActive(false); StartCoroutine(bl_RoomMenu.FadeOut(1)); bl_UtilityHelper.LockCursor(true); Joined = true; #else bl_PlayerSelector ps = FindObjectOfType <bl_PlayerSelector>(); if (ps.IsSelected) { ps.SpawnSelected(); } else { ps.OpenSelection(t_team); } #endif } else { m_RoomCamera.gameObject.SetActive(true); } } else { this.GetComponent <bl_RoomMenu>().WaitForSpectator = true; } }