private void Start() { if (isServer) { Instantiate(serverSideGameManager); } else { if (isDebug) { Match debugMatch = new Match(); debugMatch.MatchID = 13; debugMatch.ProcessID = 9156; PlayerInfoData playerInfoData = new PlayerInfoData("cZE3aJKSS50lCuXkelhz7Q", "sagnic"); Dictionary <string, PlayerInfoData> dic = new Dictionary <string, PlayerInfoData>(); dic.Add("cZE3aJKSS50lCuXkelhz7Q", playerInfoData); debugMatch.playerList = dic; OnMatchBegun(debugMatch); } else { InitialiseEnterNameScreen(); //Instantiate(clientSideGameManager); //Instantiate(characterSelectionScreen, Canvas, false); } } }
public void OnPlayerLeftRoom(PlayerInfoData player) { Debug.Log("Player Left room : " + player.Name); if (MultiplayerManager.instance.matchConditionManagerGORef != null) { MatchConditionManager matchConditionManager = MultiplayerManager.instance.matchConditionManagerGORef.GetComponent <MatchConditionManager>(); matchConditionManager.DisableStartGame(); } RemovePlayer(player); }
void RemovePlayer(PlayerInfoData playerInfoData) { if (playerInfoDic.ContainsKey(playerInfoData.connectionId)) { PlayerInfo playerInfo = playerInfoDic[playerInfoData.connectionId]; Destroy(playerInfo.gameObject); playerInfoDic.Remove(playerInfoData.connectionId); } else { Debug.LogError("No player found to remove " + playerInfoData.Name); } }
void AddNewPlayer(PlayerInfoData playerInfoData) { if (playerInfoDic.ContainsKey(playerInfoData.connectionId)) { Debug.LogError("Already containing connection id for player: " + playerInfoData.Name); } else { GameObject playerGORef = Instantiate(playerGO, playerParentTrans, false); PlayerInfo playerInfo = playerGORef.GetComponent <PlayerInfo>(); playerInfo.Initialise(playerInfoData); playerInfoDic.Add(playerInfoData.connectionId, playerInfo); } }
public void Initialise(PlayerInfoData player) { this.player = player; playerNameText.text = this.player.Name; }
public void OnPlayerJoinedRoom(PlayerInfoData player) { Debug.Log("New player joined room : " + player.Name); AddNewPlayer(player); }