Exemplo n.º 1
0
        public bool HostGame(string _matchID, GameObject _player, bool publicMatch, out int playerIndex, int maxPlayers, Match.MatchType matchType)
        {
            playerIndex = -1;
            Debug.Log("estoy llamando HOST GAME");

            if (!matchIDs.Contains(_matchID))
            {
                matchIDs.Add(_matchID);
                Match match = new Match(_matchID, _player, publicMatch, maxPlayers, matchType);
                matches.Add(match);
                Debug.Log($"Match generated");
                _player.GetComponent <PlayerNetwork>().currentMatch = match;

                for (int i = 0; i < matches.Count; i++)
                {
                    if (matches[i].matchID == _matchID)
                    {
                        roomListManager.FillListHost(matches[i].players.ToArray(), _matchID);
                    }
                }

                playerIndex = 1;
                return(true);
            }
            else
            {
                Debug.Log($"Match ID already exists");
                return(false);
            }
        }