Example #1
0
 public Match(Player firstPlayer, Player secondPlayer, Tournament.SurfaceType surfaceType, Tournament.TournamentType tournamentType)
 {
     m_playerOne      = firstPlayer;
     m_playerTwo      = secondPlayer;
     m_surfaceType    = surfaceType;
     m_tournamentType = tournamentType;
 }
Example #2
0
    /// <summary>
    /// Calculates match points of the players.
    /// </summary>
    /// <param name="playerOne">First player.</param>
    /// <param name="playerTwo">Second player.</param>
    /// <param name="surfaceType">Tournament surface type.</param>
    void SetPlayerPoints(Player playerOne, Player playerTwo, Tournament.SurfaceType surfaceType)
    {
        playerOne.ResetMatchPoint();
        playerTwo.ResetMatchPoint();

        playerOne.GainMatchPoint(1);
        if (playerOne.Hand == Player.HandType.Left)
        {
            playerOne.GainMatchPoint(2);
        }

        playerTwo.GainMatchPoint(1);
        if (playerTwo.Hand == Player.HandType.Left)
        {
            playerTwo.GainMatchPoint(2);
        }

        if (playerOne.Experience > playerTwo.Experience)
        {
            playerOne.GainMatchPoint(3);
        }
        else if (playerOne.Experience < playerTwo.Experience)
        {
            playerTwo.GainMatchPoint(3);
        }

        if (surfaceType == Tournament.SurfaceType.Clay)
        {
            if (playerOne.SurfaceSkillSet.ClayExp > playerTwo.SurfaceSkillSet.ClayExp)
            {
                playerOne.GainMatchPoint(4);
            }
            else if (playerOne.SurfaceSkillSet.ClayExp < playerTwo.SurfaceSkillSet.ClayExp)
            {
                playerTwo.GainMatchPoint(4);
            }
        }
        else if (surfaceType == Tournament.SurfaceType.Grass)
        {
            if (playerOne.SurfaceSkillSet.GrassExp > playerTwo.SurfaceSkillSet.GrassExp)
            {
                playerOne.GainMatchPoint(4);
            }
            else if (playerOne.SurfaceSkillSet.GrassExp < playerTwo.SurfaceSkillSet.GrassExp)
            {
                playerTwo.GainMatchPoint(4);
            }
        }
        else if (surfaceType == Tournament.SurfaceType.Hard)
        {
            if (playerOne.SurfaceSkillSet.HardExp > playerTwo.SurfaceSkillSet.HardExp)
            {
                playerOne.GainMatchPoint(4);
            }
            else if (playerOne.SurfaceSkillSet.HardExp < playerTwo.SurfaceSkillSet.HardExp)
            {
                playerTwo.GainMatchPoint(4);
            }
        }
    }