Exemplo n.º 1
0
 private void Play()
 {
     while (bothAlive)
     {
         //This a full round
         if (player1.player.isAlive)
         {
             Round(player1, player2);
         }
         if (player2.player.isAlive)
         {
             Round(player2, player1);
         }
     }
     if (player1.player.isAlive && !player2.player.isAlive)
     {
         player1.Send(ServerToClient.Win);
         player2.Send(ServerToClient.Loss);
     }
     else if (!player1.player.isAlive && player2.player.isAlive)
     {
         player2.Send(ServerToClient.Win);
         player1.Send(ServerToClient.Loss);
     }
     else
     {
         player1.Send(ServerToClient.Loss);
         player2.Send(ServerToClient.Loss);
     }
     player1.Send(ServerToClient.EnemyShips, player2.player.shipBoard);
     player2.Send(ServerToClient.EnemyShips, player1.player.shipBoard);
     server.EndGame(this);
 }