Esempio n. 1
0
 public void RefereePrefer(Referee referee)
 {
     if (isActive == true)
     {
         Team favTeam = referee.FavouriteTeam;
         favTeam.result += 3;
         ChangeScoreNotify?.Invoke(this, new GameEventArgs($" {referee.FavouriteTeam.Name} is lucky today.  Now they have {referee.FavouriteTeam.result}"));
         if (referee.FavouriteTeam.result >= maxScore)
         {
             FinalResult();
         }
     }
 }
Esempio n. 2
0
 public void CouchTime(Coach coach)
 {
     if (isActive == true)
     {
         Team team = coach.Team;
         if (coach.Experience >= 20)
         {
             team.result += 3;
         }
         else if (coach.Experience >= 40)
         {
             team.result += 4;
         }
         ChangeScoreNotify?.Invoke(this, new GameEventArgs($" {coach.Team} is getting bonus from couch"));
         if (team.result >= maxScore)
         {
             FinalResult();
         }
     }
 }
Esempio n. 3
0
 public void Gol(int playerId, Game game)
 {
     try
     {
         var team = teamMod.GetList().Select(p => p).Where(p => p.players.Any(x => x.Id == playerId)).First();
         if (isActive == true)
         {
             if (team?.result < game.MaxScore)
             {
                 //  team.result += 1;
                 ChangeScoreNotify?.Invoke(this, new GameEventArgs("Goal!!!" + Environment.NewLine + $"Team {team.Name} scored a goal. Now they have {team.result} points"));
             }
             else
             {
                 FinalResult();
             }
         }
     }
     catch
     {
         Console.WriteLine(StringLiterals.NoSuchPlayerInTeam);
     }
 }
Esempio n. 4
0
 public void ShowScore(Team team1, Team team2)
 {
     ChangeScoreNotify?.Invoke(this, new GameEventArgs($"{team1.Name} {team1.result} : {team2.Name} {team2.result}"));
 }
Esempio n. 5
0
 public void FinalResult()
 {
     ChangeScoreNotify?.Invoke(this, new GameEventArgs(StringLiterals.Final));
     isActive = false;
 }
Esempio n. 6
0
 public void Whistle()
 {
     isActive = true;
     ChangeScoreNotify?.Invoke(this, new GameEventArgs(StringLiterals.Whistle));
 }