private void HandleCheckHit(CheckHit x) { player.MyTurn = true; //tell attacker if its hit var isHit = IsShipHitted(x.X, x.Y); var hitResponse = new HitResponse(x, isHit); if (isHit) { rtxBox2.Text += $"I have been attacked on {x.X},{x.Y}; HIT.\n"; var isOver = IsGameOver(player.ShipSet); if (isOver == true) { rtxBox2.Text += $"GAME OVER"; opponent.Tell(new GameOver(player.PlayerNumber, username)); } else { opponent.Tell(hitResponse); } } else { rtxBox2.Text += $"I have been attacked on {x.X},{x.Y}; MISS.\n"; opponent.Tell(hitResponse); } }
private void HandleHitResponse(HitResponse x) { if (x.isHit) { rtxBox2.Text += $"My shot on coordinate {x.CheckHit.X},{x.CheckHit.Y} was HIT.\n"; player.OpponentBoard[x.CheckHit.X, x.CheckHit.Y] = 1; } else { rtxBox2.Text += $"My shot on coordinate {x.CheckHit.X},{x.CheckHit.Y} was MISS.\n"; } }