Esempio n. 1
0
        public static void StartGame()
        {
            PingPongArg pingPongArg = new PingPongArg();

            pingPongArg.Count                   = 999;
            pingPongArg.pingPlayer              = new Ping();
            pingPongArg.pingPlayer.PingHandler += GetPing;


            pingPongArg.pongPlayer              = new Pong();
            pingPongArg.pongPlayer.PongHandler += GetPong;

            pingPongArg.pingPlayer.PingMethod(pingPongArg);
        }
Esempio n. 2
0
        public static void GetPong(object sender, PingPongArg arg, string message)
        {
            if (arg.Count == 0)
            {
                Console.WriteLine("Game is stopped");
            }
            else
            {
                arg.Count--;

                Console.WriteLine($"{message} осталось проходов: {arg.Count}");

                arg.pingPlayer.PingMethod(arg);
            }
        }
Esempio n. 3
0
 public void PongMethod(PingPongArg arg)
 {
     pongHandler?.Invoke(this, arg, message);
 }