private void OnShipSunk(Ship ship) { var packet = new S2C_GameBoardUpdated(BoardOwner.ME, ship.Cells.Select(t => t.GetSimplifiedCell())); ship.Board.Player.RemotePlayer.Connection.Send(packet); packet.BoardOwner = BoardOwner.ENEMY; ship.Board.Player.Opponent.RemotePlayer.Connection.Send(packet); }
private void OnBoardCellStateChanged(Board board, SeaCell cell) { if (cell.CellState == SeaCellState.SHIP_SUNK) { //There is a seperate event for that (OnShipSunk) to compress it down into one packet. return; } var packet = new S2C_GameBoardUpdated(BoardOwner.ME, new[] { cell.GetSimplifiedCell() }); board.Player.RemotePlayer.Connection.Send(packet); packet.BoardOwner = BoardOwner.ENEMY; board.Player.Opponent.RemotePlayer.Connection.Send(packet); }