You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Trek-12/source/Trek-12/Models/BestScore.cs

49 lines
1.0 KiB

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Models
{
public class BestScore
{
public BestScore(int gamesPlayed, int score)
{
GamesPlayed = gamesPlayed;
Score = score;
if (GamesPlayed < 0)
GamesPlayed = 0;
if (Score < 0)
Score = 0;
}
public int GamesPlayed { get; private set; }
private int _score;
public int Score
{
get
{
return _score;
}
private set
{
if (value > _score)
_score = value;
}
}
public override string ToString()
{
return $"Ce joueur a joué {GamesPlayed} parties et à pour meilleur score {Score}";
}
public void IncrGamesPlayed()
{
GamesPlayed += 1;
}
}
}