Exemple #1
0
 public void JoinGame(DriveClub Game)
 {
     // Подписываемся на игру
     Game.Move   += this.Move;
     Game.MoveTo += this.MoveTo;
     Finish       = Game.OnFinis;
 }
Exemple #2
0
        static void Main(string[] args)
        {
            DriveClub game = new DriveClub();

            Random rand  = new Random();
            Cars   name  = (Cars)rand.Next(1, 4);
            Cars   name2 = (Cars)rand.Next(1, 4);

            int     speed1 = rand.Next(1, 100);
            int     speed2 = rand.Next(1, 100);
            MoveObj car1   = new Car()
            {
                Name = name.ToString(), Speed = speed1
            };
            MoveObj car2 = new Car()
            {
                Name = name2.ToString(), Speed = speed2
            };

            car1.JoinGame(game);
            car2.JoinGame(game);

            game.Run();

            Console.WriteLine("Победил " + game.Winner + " машина");

            Console.ReadLine();
        }