Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        //Groups stage
        if (tourInfo.matchesRound < 3)
        {
            int roundMatch = tourInfo.matchesRound + 1;
            roundText.text = "Round " + roundMatch.ToString();
            SetInformationForNextMatch();
        }

        //For finals
        if (tourInfo.matchesRound >= 3)
        {
            if (tourInfo.IsPlayerInFinals())
            {
                SetInformationForNextMatch();
                groupsPanel.SetActive(false);
                finalsPanel.SetActive(true);
            }
            else
            {
                SetGameOverState();
            }
        }

        if (tourInfo.finalMatch.played)
        {
            if (tourInfo.GetMatchWinnerTeamInfo(tourInfo.finalMatch).teamName == tourInfo.teamSelected)
            {
                SetChampionPanel();
            }
            else
            {
                SetGameOverState();
            }
        }
        else
        {
            //Set results panel
            SetResultsPanel();
            //Set finals panel
            SetFinalsPanel();
        }


        //Get teams amount and index group of team selected.
        teamsInTour = tourInfo.teamsAmount;
        indexGroupOfteamSelected = GetTeamGroupSelectedIndex();

        //Set teams in panel.
        //The list was previously order by groups when the tournament was created.
        SetTeamsPositionPanel(OrderTeamsByPoints(tourInfo.teamList));
        ShowTeamsInPanel(indexGroupOfteamSelected);

        groupText.text = "Group " + tourInfo.teamList[indexGroupOfteamSelected].teamGroup;
    }