Exemple #1
0
 private void StartGame()
 {
     RandomTurn();
     player1.SendObject(new GameStarted {
         YourTurn = player1 == playerTurn
     });
     player2.SendObject(new GameStarted {
         YourTurn = player2 == playerTurn
     });
 }
Exemple #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
            });
        }
Exemple #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);
        }
 public void OnPing(IObjectConnection connection, PingObject pingObject)
 {
     connection.SendObject(new PongObject());
 }