Exemplo n.º 1
0
 /// <summary>
 /// Добавить нового игрока в список
 /// </summary>
 /// <param name="name"></param>
 /// <param name="keyName"></param>
 /// <param name="basicPosition"></param>
 public void AddNewPlayer(string name, string keyName, FootballPosition basicPosition)
 {
     //тут проверка базовых значений
     if (CheckInputBasicData(name, keyName, basicPosition))
     {
         IFootballPlayer pl = new FootballPlayer {
             Name = name, KeyName = keyName, BasicPlayPosition = basicPosition, IsActive = true
         };
         (_playerList as FootballPlayerList).Add(pl);
     }
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            List <FootballPlayer> footballPlayers = new List <FootballPlayer>();

            var ronaldo  = new FootballPlayer("Ronaldo", 33, GetFootballPlayerLevel());
            var messi    = new FootballPlayer("Messi", 22, GetFootballPlayerLevel());
            var mbappe   = new FootballPlayer("Mbappé", 36, GetFootballPlayerLevel());
            var hazard   = new FootballPlayer("Hazard", 31, GetFootballPlayerLevel());
            var bale     = new FootballPlayer("Bale", 29, GetFootballPlayerLevel());
            var sterling = new FootballPlayer("Sterling", 26, GetFootballPlayerLevel());

            footballPlayers.Add(ronaldo);
            footballPlayers.Add(messi);
            footballPlayers.Add(mbappe);
            footballPlayers.Add(hazard);
            footballPlayers.Add(bale);
            footballPlayers.Add(sterling);

            var team1 = new Team("team1", new Coach("Levin", GetCoachLuckyLevel()));
            var team2 = new Team("team2", new Coach("Borisov", GetCoachLuckyLevel()));

            team1.AddTeamMember(ronaldo);
            team1.AddTeamMember(messi);
            team1.AddTeamMember(mbappe);
            team2.AddTeamMember(hazard);
            team2.AddTeamMember(bale);
            team2.AddTeamMember(sterling);

            Judge judge = new Judge("Alehandro", GetJudgeChoice());
            Game  game  = new Game(team1, team2, judge);

            game.GetGameResult();
            Console.WriteLine("\nИгроки первой команды старше 30ти\n");
            team1.ShowPlayersOver30();
            Console.WriteLine("\nИгроки второй команды в алфавитном порядке\n");
            team2.ShowAllPlayers();

            Console.ReadKey();
        }
Exemplo n.º 3
0
 public void AddTeamMember(FootballPlayer footballPlayer)
 {
     team.Add(footballPlayer);
     TeamLevel += footballPlayer.Level;
 }