Ejemplo n.º 1
0
 void WaitForPlayers()
 {
     //Check to see if the player count is smaller then max players allowed for this room
     if (PhotonNetwork.room.PlayerCount < maxPlayers)
     {
         Debug.Log("waiting for Players");
         Debug.Log("There are " + PhotonNetwork.room.PlayerCount + " Players in Queue");
     }
     else
     {
         if (PhotonNetwork.isMasterClient)
         {
             PhotonNetwork.player.SetTeam(PunTeams.Team.red);
             PhotonNetwork.LoadLevel("MainScene");
             Debug.Log(StartGame);
         }
         //Set Player Properties
         properties.Add("Deaths", 0);
         properties.Add("NickName", PlayerPrefs.GetString("NickName").ToString());
         roomProperties.Add("RedScore", 0);
         roomProperties.Add("BlueScore", 0);
         roomProperties.Add("FlagSide", 0);
         PhotonNetwork.player.SetCustomProperties(properties);
         PhotonNetwork.room.SetCustomProperties(roomProperties);
         StartGame = true;
         punteams.UpdateTeams();
     }
 }
Ejemplo n.º 2
0
 public void AddPlayersToTeam(Player player)
 {
     Debug.Log(PunTeams.PlayersPerTeam[PunTeams.Team.blue].Count);
     Debug.Log(PunTeams.PlayersPerTeam[PunTeams.Team.red].Count);
     if (PunTeams.PlayersPerTeam[PunTeams.Team.blue].Count < PunTeams.PlayersPerTeam[PunTeams.Team.red].Count)
     {
         Debug.Log("blue");
         TeamExtensions.SetTeam(player, PunTeams.Team.blue);
     }
     else if (PunTeams.PlayersPerTeam[PunTeams.Team.blue].Count >= PunTeams.PlayersPerTeam[PunTeams.Team.red].Count)
     {
         Debug.Log("red");
         TeamExtensions.SetTeam(player, PunTeams.Team.red);
     }
     punTeams.UpdateTeams();
     // pv.RPC("RPC_AddPlayersToTeam", RpcTarget.All, playername);
 }