Exemplo n.º 1
0
    /// <summary>
    /// <para>This method sets the list of the teams that participate in the tournament.</para>
    /// This is attached to the button of the tournament in TournamentSelectionScene.
    /// </summary>
    /// <param name="tour">Tournament scriptable object</param>
    public void FillTournamentTeamsInfo(Tournament tour)
    {
        //Clear matche's list
        teamList.Clear();
        playerMatches.Clear();
        groupPhaseMatches.Clear();
        //Every time a tournament button is pressed the list is cleared and the groups array is refilled.
        for (int i = 0; i < groupsCount.Length; i++)
        {
            groupsCount[i] = 4;
        }

        //Iterate over the teams in the tournament and filled its information related to this new tournament created.
        for (int i = 0; i < teamsAmount; i++)
        {
            Team team = tour.teams[i];

            //Create the team's info for this tournament.
            //Assign a random group in the tour and add it to the list.
            TeamTourInfo teamTour = new TeamTourInfo(team.name, RandomGroup(), 0, 0, 0, 0, 0, 0, 0, 0);
            teamList.Add(teamTour);
        }

        //Order the team's list by group
        List <TeamTourInfo> sortedList = teamList.OrderBy(team => team.teamGroup).ToList();

        teamList = sortedList;
        //Create the matches of the group phase of the tournament.
        CreateGroupPhaseMatches();
    }
Exemplo n.º 2
0
 public MatchTourInfo(MatchTourInfo info)
 {
     localTeam   = info.localTeam;
     localGoals  = info.localGoals;
     visitTeam   = info.visitTeam;
     visitGoals  = info.visitGoals;
     matchNumber = info.matchNumber;
     played      = info.played;
 }
Exemplo n.º 3
0
 public MatchTourInfo(TeamTourInfo local_team, int local_goals, TeamTourInfo visit_team, int visit_goals, int match_number, bool _played)
 {
     localTeam   = local_team;
     localGoals  = local_goals;
     visitTeam   = visit_team;
     visitGoals  = visit_goals;
     matchNumber = match_number;
     played      = _played;
 }
Exemplo n.º 4
0
    /// <summary>
    /// Get winner of both key and create final match
    /// </summary>
    private void CreateFinalMatch()
    {
        TeamTourInfo  leftKeyWinner  = GetMatchWinnerTeamInfo(leftKeyFinalMatches[leftKeyFinalMatches.Count - 1]);
        TeamTourInfo  rightKeyWinner = GetMatchWinnerTeamInfo(rightKeyFinalMatches[rightKeyFinalMatches.Count - 1]);
        MatchTourInfo final          = new MatchTourInfo(leftKeyWinner, 0, rightKeyWinner, 0, matchesRound, false);

        finalMatch = final;
        if (IsPlayerMatch(final))
        {
            playerMatches.Add(final);
        }
    }
Exemplo n.º 5
0
 public TeamTourInfo(TeamTourInfo info)
 {
     teamName          = info.teamName;
     teamGroup         = info.teamGroup;
     victories         = info.victories;
     knockoutVictories = info.knockoutVictories;
     draws             = info.draws;
     defeats           = info.defeats;
     knockoutDefeats   = info.knockoutDefeats;
     goalsScored       = info.goalsScored;
     goalsReceived     = info.goalsReceived;
     goalDifference    = info.goalsScored - info.goalsReceived;
     points            = info.points;
 }