Ejemplo n.º 1
0
 private void StartGame()
 {
     RandomTurn();
     player1.SendObject(new GameStarted {
         YourTurn = player1 == playerTurn
     });
     player2.SendObject(new GameStarted {
         YourTurn = player2 == playerTurn
     });
 }
Ejemplo n.º 2
0
        private void NextPlayerTurn(int x, int y)
        {
            if (playerTurn == player1)
            {
                playerTurn = player2;
            }
            else
            {
                playerTurn = player1;
            }

            playerTurn.SendObject(new YourTurn {
                X = x, Y = y
            });
        }
Ejemplo n.º 3
0
        private void YourTurn()
        {
            Console.WriteLine("It is your turn:");

            Move move = null;

            while (true)
            {
                string input = Console.ReadLine();
                move = GetMove(input);
                if (move != null && TileFree(move.X, move.Y))
                {
                    break;
                }
            }

            grid[move.X][move.Y] = 1;
            OutputBoard();
            Console.WriteLine("Waiting for your opponent to make his play");

            connection.SendObject(move);
        }
Ejemplo n.º 4
0
 public void OnPing(IObjectConnection connection, PingObject pingObject)
 {
     connection.SendObject(new PongObject());
 }