public void ShotResult(ShotResult shotResult) { int x = shotResult.getCoordinates().X; int y = shotResult.getCoordinates().Y; bool result = shotResult.isHit(); if (result) { ships[x, y].State = Ship.ShipState.HIT; } else { ships[x, y].State = Ship.ShipState.MISSED; } }
public static String ToXMLString(ShotResult shotResult) { String result = "<shotResult isNull=\""; if (shotResult == null) result += "true\""; else { result += "false\""; result += " isHit=\"" + (shotResult.isHit() ? "true" : "false") + "\""; result += " isSunk=\"" + (shotResult.isSunk() ? "true" : "false") + "\""; result += " isGameEnded=\"" + (shotResult.isGameEnded() ? "true" : "false") + "\""; result += " matrix=\""; result += ((shotResult.getMatrix() == null) ? "null" : Global.boolArrayToString(shotResult.getMatrix())) + "\""; } result += ">" + Coordinates.ToXMLString(shotResult.getCoordinates()) + "</shotResult>"; return result; }
public static String ToXMLString(ShotResult shotResult) { String result = "<shotResult isNull=\""; if (shotResult == null) { result += "true\""; } else { result += "false\""; result += " isHit=\"" + (shotResult.isHit() ? "true" : "false") + "\""; result += " isSunk=\"" + (shotResult.isSunk() ? "true" : "false") + "\""; result += " isGameEnded=\"" + (shotResult.isGameEnded() ? "true" : "false") + "\""; result += " matrix=\""; result += ((shotResult.getMatrix() == null) ? "null" : Global.boolArrayToString(shotResult.getMatrix())) + "\""; } result += ">" + Coordinates.ToXMLString(shotResult.getCoordinates()) + "</shotResult>"; return(result); }
public void ShotResult(ShotResult shotResult) { int x = shotResult.getCoordinates().X; int y = shotResult.getCoordinates().Y; bool result = shotResult.isHit(); if (result) ships[x, y].State = Ship.ShipState.HIT; else ships[x, y].State = Ship.ShipState.MISSED; }