Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 6
0
 public void OnPlayerJoinedRoom(PlayerInfoData player)
 {
     Debug.Log("New player joined room : " + player.Name);
     AddNewPlayer(player);
 }