public ShotResult(bool isHit, bool isSunk, bool isGameEnded, Coordinates coordinates, bool[,] matrix)
 {
     this.hit = isHit;
     this.sunk = isSunk;
     this.gameEnded = isGameEnded;
     this.coordinates = coordinates;
     this.matrix = matrix;
 }
        public static String ToXMLString(Coordinates coordinates)
        {
            String result = "<coordinates isNull=\"";
            if (coordinates == null)
                result += "true\"";
            else
                result += "false\" x=\"" + coordinates.X + "\" y=\"" + coordinates.Y + "\"";

            result += "/>";
            return result;
        }
 public GamePacket(int x, int y)
 {
     coordinates = Coordinates.Get(x, y);
     type = TYPE.SHOT;
 }
 public GamePacket(Coordinates coordinates)
 {
     this.coordinates = coordinates;
     type = TYPE.SHOT;
 }
Example #5
0
 public ShotResult Shoot(Coordinates field)
 {
     int x = field.X;
     int y = field.Y;
     if (ships[x, y].Shoot())
         return markShipAsSunkIfReallyIs(x, y);
     else
         return new ShotResult(false, false, isGameEnded(), Coordinates.Get(x, y), (bool[,])null);
 }
 public void setCoordinates(Coordinates coordinates)
 {
     this.coordinates = coordinates;
 }