Beispiel #1
0
    public bool JoinTeam(PhotonPlayer currentPlayer, Team team, Role role)
    {
        bool positionAvailable = true;

        for (int i = 0; i < PhotonNetwork.playerList.Length; i++)
        {
            PhotonPlayer player = PhotonNetwork.playerList[i];
            if ((player.GetTeam() == team) && (player.GetRole() == role))
            {
                positionAvailable = false;
            }
        }

        if (positionAvailable)
        {
            currentPlayer.SetTeam(team);
            currentPlayer.SetRole(role);
            UpdateTeams();
            return(true);
        }

        return(false);
    }