/// <summary> /// Remove the player from the player ready list /// </summary> /// <param name="_playerID">Id of the removed player</param> public void RemovePlayer(int _playerID) { PhotonPlayer _player = PhotonPlayer.Find(_playerID); if (!TDS_GameManager.PlayersInfo.Any(i => i.PhotonPlayer == _player)) { return; } TDS_PlayerInfo _info = TDS_GameManager.PlayersInfo.Where(i => i.PhotonPlayer == _player).First(); TDS_GameManager.PlayersInfo.Remove(_info); }
/// <summary> /// Make the player with the type contained in the GameManager spawn /// </summary> public void Spawn() { if (PhotonNetwork.offlineMode) { for (int i = 0; i < TDS_GameManager.PlayersInfo.Count; i++) { TDS_PlayerInfo _info = TDS_GameManager.PlayersInfo[i]; if ((_info != null) && (_info.PlayerType != PlayerType.Unknown)) { otherPlayers.Add((Instantiate(Resources.Load(_info.PlayerType.ToString()), StartSpawnPoints[0], Quaternion.identity) as GameObject).GetComponent <TDS_Player>()); } } TDS_Camera.Instance.SetLocalMultiplayerCamera(); } else if (TDS_GameManager.LocalPlayer != PlayerType.Unknown) { localPlayer = PhotonNetwork.Instantiate(TDS_GameManager.LocalPlayer.ToString(), StartSpawnPoints[0], Quaternion.identity, 0).GetComponent <TDS_Player>(); TDS_Camera.Instance.Target = localPlayer.transform; } }