//this component allow us to keep the color selected by the player on the lobby, it will be the color of the player when the game start.

    public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer)
    {
        base.OnLobbyServerSceneLoadedForPlayer(manager, lobbyPlayer, gamePlayer);

        Prototype.NetworkLobby.LobbyPlayer lobbyP = lobbyPlayer.GetComponent <Prototype.NetworkLobby.LobbyPlayer>();
        PlayerColor cameraPlayer = gamePlayer.GetComponent <PlayerColor>(); //access to the playerColor component, wich has the information of the color

        cameraPlayer.pColor = lobbyP.playerColor;                           //Makes the player color the same as the selected by the player on the lobby
    }
 public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer)
 {
     if (lobbyPlayer == null)
     {
         return;
     }
     Prototype.NetworkLobby.LobbyPlayer lp = lobbyPlayer.GetComponent <Prototype.NetworkLobby.LobbyPlayer>();
     if (lp != null)
     {
         GameManager.AddPlayer(gamePlayer, lp.nameInput.text);
     }
 }
Exemple #3
0
        public void AddPlayer(LobbyPlayer player)
        {
            if (_players.Contains(player))
                return;

            _players.Add(player);

            player.transform.SetParent(playerListContentTransform, false);
            addButtonRow.transform.SetAsLastSibling();

            PlayerListModified();
        }
    public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer)
    {
        if (lobbyPlayer == null)
        {
            return;
        }

        Prototype.NetworkLobby.LobbyPlayer lp = lobbyPlayer.GetComponent <Prototype.NetworkLobby.LobbyPlayer>();

        if (lp != null)
        {
            GameManager.AddTank(gamePlayer, lp.slot, lp.playerColor, lp.nameInput.text, lp.playerControllerId, lp.connectionToClient.connectionId);
        }
    }
Exemple #5
0
 //This will reset every player's character selection to observer
 void lobby_change_map(int new_map)
 {
     if (map != new_map)
     {
         map = (int)new_map;
         for (int i = 0; i < lobbyManager.lobbySlots.Length; i++)
         {
             if (lobbyManager.lobbySlots[i] == null)
             {
                 continue;
             }
             Prototype.NetworkLobby.LobbyPlayer player = (Prototype.NetworkLobby.LobbyPlayer)lobbyManager.lobbySlots[i];
             player.reset_character();
         }
     }
 }
Exemple #6
0
 public void RemovePlayer(LobbyPlayer player)
 {
     player.RemovePlayer();
 }
Exemple #7
0
 public void RemovePlayer(LobbyPlayer player)
 {
     player.RemovePlayer();
 }
 public void RemovePlayer(LobbyPlayer player)
 {
     _players.Remove(player);
     PlayerListModified();
 }
Exemple #9
0
 public void RemovePlayer(LobbyPlayer player)
 {
     _players.Remove(player);
     PlayerListModified();
 }
Exemple #10
0
        // --- Countdown management

        public override void OnLobbyServerPlayersReady()
        {
            int  blueteam = 0;
            int  redteam  = 0;
            bool allready = true;

            for (int i = 0; i < lobbySlots.Length; ++i)
            {
                if (lobbySlots[i] != null)
                {
                    allready &= lobbySlots[i].readyToBegin;
                }
                if (lobbySlots [i] != null)
                {
                    if ((lobbySlots [i] as LobbyPlayer).colorButton.image.color == Color.blue)
                    {
                        ++blueteam;
                    }
                    else if ((lobbySlots [i] as LobbyPlayer).colorButton.image.color == Color.red)
                    {
                        ++redteam;
                    }
                }
            }
            if (allready)
            {
                int roirouge = Random.Range(1, redteam);
                int roibleu  = Random.Range(1, blueteam);
                int tmpred   = 0;
                int tmpblue  = 0;
                Debug.Log("Les rois a trouver sont " + redteam + blueteam);
                for (int p = 0; p < lobbySlots.Length; ++p)
                {
                    Debug.Log("dans la boucle");
                    if (lobbySlots[p] != null)
                    {                    //there is maxPlayer slots, so some could be == null, need to test it before accessing!
                        Debug.Log("dans le if non nul");
                        if ((lobbySlots [p] as LobbyPlayer).colorButton.GetComponent <Image>().color == Color.blue)
                        {
                            ++tmpblue;
                            Debug.Log("joueur bleu numero " + tmpblue);
                            if (tmpblue == roibleu)
                            {
                                (lobbySlots [p] as LobbyPlayer).RpcisKingCountdown(true);
                            }
                        }
                        if ((lobbySlots [p] as LobbyPlayer).colorButton.GetComponent <Image>().color == Color.red)
                        {
                            ++tmpred;
                            Debug.Log("joueur rouge numero " + tmpred + "joueur rouge a trouver " + roirouge);
                            if (tmpred == roirouge)
                            {
                                Debug.Log("dans le tmpred==roirouge");
                                LobbyPlayer t = lobbySlots[p] as LobbyPlayer;
                                t.RpcisKingCountdown(true);
                            }
                        }
                    }
                }
                StartCoroutine(ServerCountdownCoroutine());
            }
        }
Exemple #11
0
        public void RemovePlayer(LobbyPlayer player)
        {
            Audio.Play("Click");

            player.RemovePlayer();
        }
 public int GetPlayerIndex(LobbyPlayer player)
 {
     return(_players.IndexOf(player));
 }