public Ship(ShipName name) { int shipLength = 0; switch (name) { case ShipName.patrol: shipLength = 2; break; case ShipName.submarine: case ShipName.battleship: shipLength = 3; break; case ShipName.destroyer: shipLength = 4; break; case ShipName.carrier: shipLength = 5; break; } this.position = new Square[shipLength]; this.length = shipLength; this.isSunk = false; this.name = name; for(int i = 0; i < length; i++) { this.position[i] = new Square(); } }
public Ship(ShipName name, int size) { this.name = name; this.size = size; location = new List<int>(size); }
public Ship(ShipName ship) { _shipName = ship; _tiles = new List<Tile>(); //gets the ship size from the enumarator _sizeOfShip = (int)_shipName; }
/// <summary> /// Handles user input for the Deployment phase of the game. /// </summary> /// <remarks> /// Involves selecting the ships, deloying ships, changing the direction /// of the ships to add, randomising deployment, end then ending /// deployment /// </remarks> public static void HandleDeploymentInput() { if (SwinGame.KeyTyped(KeyCode.vk_ESCAPE)) { GameController.AddNewState(GameState.ViewingGameMenu); } if (SwinGame.KeyTyped(KeyCode.vk_UP) | SwinGame.KeyTyped(KeyCode.vk_DOWN)) { _currentDirection = Direction.UpDown; } if (SwinGame.KeyTyped(KeyCode.vk_LEFT) | SwinGame.KeyTyped(KeyCode.vk_RIGHT)) { _currentDirection = Direction.LeftRight; } if (SwinGame.KeyTyped(KeyCode.vk_r)) { GameController.HumanPlayer.RandomizeDeployment(); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { ShipName selected = default(ShipName); selected = GetShipMouseIsOver(); if (selected != ShipName.None) { _selectedShip = selected; } else { DoDeployClick(); } if (GameController.HumanPlayer.ReadyToDeploy & IsMouseInRectangle (PLAY_BUTTON_LEFT, TOP_BUTTONS_TOP, PLAY_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.EndDeployment (); } else if (UtilityFunctions.IsMouseInRectangle (UP_DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.UpDown; } else if (UtilityFunctions.IsMouseInRectangle (LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.LeftRight; } else if (UtilityFunctions.IsMouseInRectangle (RANDOM_BUTTON_LEFT, TOP_BUTTONS_TOP, RANDOM_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.HumanPlayer.RandomizeDeployment (); } else if (UtilityFunctions.IsMouseInRectangle(RANDOM_BUTTON_LEFT-70,TOP_BUTTONS_TOP,51,51)) { if (_currentDirection == Direction.LeftRight) { _currentDirection = Direction.UpDown; } else { _currentDirection = Direction.LeftRight; } } } }
/// <summary> /// Handles user input for the Deployment phase of the game. /// </summary> /// <remarks> /// Involves selecting the ships, deloying ships, changing the direction /// of the ships to add, randomising deployment, end then ending /// deployment /// </remarks> public static void HandleDeploymentInput() { if (SwinGame.KeyTyped(KeyCode.vk_ESCAPE)) { AddNewState(GameState.ViewingGameMenu); } if (SwinGame.KeyTyped(KeyCode.vk_UP) | SwinGame.KeyTyped(KeyCode.vk_DOWN)) { _currentDirection = Direction.UpDown; } if (SwinGame.KeyTyped(KeyCode.vk_LEFT) | SwinGame.KeyTyped(KeyCode.vk_RIGHT)) { _currentDirection = Direction.LeftRight; } if (SwinGame.KeyTyped(KeyCode.vk_r)) { HumanPlayer.RandomizeDeployment(); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { ShipName selected = default(ShipName); selected = GetShipMouseIsOver(); if (selected != ShipName.None) { _selectedShip = selected; } else { DoDeployClick(); } if (HumanPlayer.ReadyToDeploy & IsMouseInRectangle(PLAY_BUTTON_LEFT, TOP_BUTTONS_TOP, PLAY_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { EndDeployment(isFirst: true); } else if (IsMouseInRectangle(UP_DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.UpDown; //@Lai Hoang Thanh Nguyen 16/09/2015 fixed issue DoChangeDirection(); //@Lai Hoang Thanh Nguyen 16/09/2015 fixed issue3 } else if (IsMouseInRectangle(LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.LeftRight; DoChangeDirection(); //@Lai Hoang Thanh Nguyen 16/09/2015 fixed issue3 } else if (IsMouseInRectangle(RANDOM_BUTTON_LEFT, TOP_BUTTONS_TOP, RANDOM_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { HumanPlayer.RandomizeDeployment(); } } }
public Ship getShip(ShipName name) { Ship requested = ships[0]; switch (name) { case ShipName.patrol: requested = ships[0]; break; case ShipName.submarine: requested = ships[1]; break; case ShipName.battleship: requested = ships[2]; break; case ShipName.destroyer: requested = ships[3]; break; case ShipName.carrier: requested = ships[4]; break; } return requested; }
/// <summary> /// @Issue3 /// @Lai Hoang Thanh Nguyen /// 16/09/2015 /// ChangeShipDirection allows for ships directing in current location. /// </summary> /// <param name="ship"></param> /// <param name="direction"></param> public void ChangeShipDirection(ShipName ship, Direction direction) { Ship newShip = _Ships[ship]; int oldRow = newShip.Row; int oldColumn = newShip.Column; Direction oldDirection = newShip.Direction; newShip.Remove(); AddShip(oldRow, oldColumn, direction, newShip, oldDirection, oldRow, oldColumn); }
private static void RecPosition(ShipName _selectedShip, int row, int col, int dir) { switch (_selectedShip.ToString()) { case "Tug": xy[0] = row; xy[1] = col; xy[2] = dir; break; case "Submarine": xy[3] = row; xy[4] = col; xy[5] = dir; break; case "Destroyer": xy[6] = row; xy[7] = col; xy[8] = dir; break; case "Battleship": xy[9] = row; xy[10] = col; xy[11] = dir; break; case "AircraftCarrier": xy[12] = row; xy[13] = col; xy[14] = dir; break; default: break; } }
private static int getPosition(ShipName _selectedShip, String info) { switch (_selectedShip.ToString()) { case "Tug": if (info == "row") {return xy[0];} else if (info=="col") {return xy[1];} else {return xy[2];}; case "Submarine": if (info == "row") {return xy[3];} else if (info=="col") {return xy[4];} else {return xy[5];}; case "Destroyer": if (info == "row") {return xy[6];} else if (info=="col") {return xy[7];} else {return xy[8];}; case "Battleship": if (info == "row") {return xy[9];} else if (info=="col") {return xy[10];} else {return xy[11];}; case "AircraftCarrier": if (info == "row") {return xy[12];} else if (info=="col") {return xy[13];} else {return xy[14];}; default: return 1; } }
public override int GetHashCode() { int hash = 1; if (OrderID != 0) { hash ^= OrderID.GetHashCode(); } if (CustomerID.Length != 0) { hash ^= CustomerID.GetHashCode(); } if (EmployeeID != 0) { hash ^= EmployeeID.GetHashCode(); } if (orderDate_ != null) { hash ^= OrderDate.GetHashCode(); } if (requiredDate_ != null) { hash ^= RequiredDate.GetHashCode(); } if (shippedDate_ != null) { hash ^= ShippedDate.GetHashCode(); } if (ShipVia != 0) { hash ^= ShipVia.GetHashCode(); } if (Freight != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Freight); } if (ShipName.Length != 0) { hash ^= ShipName.GetHashCode(); } if (ShipAddress.Length != 0) { hash ^= ShipAddress.GetHashCode(); } if (ShipCity.Length != 0) { hash ^= ShipCity.GetHashCode(); } if (ShipRegion.Length != 0) { hash ^= ShipRegion.GetHashCode(); } if (ShipPostalCode.Length != 0) { hash ^= ShipPostalCode.GetHashCode(); } if (ShipCountry.Length != 0) { hash ^= ShipCountry.GetHashCode(); } hash ^= lines_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// Handles user input for the Deployment phase of the game. /// </summary> /// <remarks> /// Involves selecting the ships, deloying ships, changing the direction /// of the ships to add, randomising deployment, end then ending /// deployment /// </remarks> public static void HandleDeploymentInput() { if (SwinGame.KeyTyped(KeyCode.vk_ESCAPE)) { AddNewState(GameState.ViewingGameMenu); } if (SwinGame.KeyTyped(KeyCode.vk_UP) | SwinGame.KeyTyped(KeyCode.vk_DOWN)) { _currentDirection = Direction.UpDown; } if (SwinGame.KeyTyped(KeyCode.vk_LEFT) | SwinGame.KeyTyped(KeyCode.vk_RIGHT)) { _currentDirection = Direction.LeftRight; } if (SwinGame.KeyTyped(KeyCode.vk_r)) { HumanPlayer.RandomizeDeployment(); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { ShipName selected = default(ShipName); selected = GetShipMouseIsOver(); if (selected != ShipName.None) { _selectedShip = selected; } else { DoDeployClick(); } if (HumanPlayer.ReadyToDeploy & IsMouseInRectangle(PLAY_BUTTON_LEFT, TOP_BUTTONS_TOP, PLAY_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { EndDeployment(); } else if (IsMouseInRectangle(UP_DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.LeftRight; } else if (IsMouseInRectangle(LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.LeftRight; } else if (IsMouseInRectangle(RANDOM_BUTTON_LEFT, TOP_BUTTONS_TOP, RANDOM_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { HumanPlayer.RandomizeDeployment(); } ///added code to detect click over the back button else if (IsMouseInRectangle(BACK_BUTTON_LEFT, TOP_BUTTONS_TOP, RANDOM_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { ///code to return to main menu to go here /// probably needs to change the state to main menu state??? /// need to figure out how to do this /// nop(); } } }
/// <summary> /// Handles user input for the Deployment phase of the game. /// </summary> /// <remarks> /// Involves selecting the ships, deloying ships, changing the direction /// of the ships to add, randomising deployment, end then ending /// deployment /// </remarks> public static void HandleDeploymentInput() { //Uwin if (SwinGame.KeyTyped(KeyCode.vk_1) | SwinGame.KeyTyped(KeyCode.vk_t)) { _selectedShip = ShipName.Tug; } if (SwinGame.KeyTyped(KeyCode.vk_2) | SwinGame.KeyTyped(KeyCode.vk_d)) { _selectedShip = ShipName.Destroyer; } if (SwinGame.KeyTyped(KeyCode.vk_3) | SwinGame.KeyTyped(KeyCode.vk_s)) { _selectedShip = ShipName.Submarine; } if (SwinGame.KeyTyped(KeyCode.vk_4) | SwinGame.KeyTyped(KeyCode.vk_b)) { _selectedShip = ShipName.Battleship; } if (SwinGame.KeyTyped(KeyCode.vk_5) | SwinGame.KeyTyped(KeyCode.vk_a)) { _selectedShip = ShipName.AircraftCarrier; } //Uwin if (SwinGame.KeyTyped(KeyCode.vk_ESCAPE)) { GameController.AddNewState(GameState.ViewingGameMenu); } if (SwinGame.KeyTyped(KeyCode.vk_UP) | SwinGame.KeyTyped(KeyCode.vk_DOWN)) { _currentDirection = Direction.UpDown; } if (SwinGame.KeyTyped(KeyCode.vk_LEFT) | SwinGame.KeyTyped(KeyCode.vk_RIGHT)) { _currentDirection = Direction.LeftRight; } if (SwinGame.KeyTyped(KeyCode.vk_r)) { GameController.HumanPlayer.RandomizeDeployment(); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { ShipName selected = default(ShipName); selected = GetShipMouseIsOver(); if (selected != ShipName.None) { _selectedShip = selected; } else { DoDeployClick(); } if (GameController.HumanPlayer.ReadyToDeploy & UtilityFunctions.IsMouseInRectangle(PLAY_BUTTON_LEFT, TOP_BUTTONS_TOP, PLAY_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.EndDeployment(); } else if (UtilityFunctions.IsMouseInRectangle(UP_DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.LeftRight; } else if (UtilityFunctions.IsMouseInRectangle(LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.LeftRight; } else if (UtilityFunctions.IsMouseInRectangle(RANDOM_BUTTON_LEFT, TOP_BUTTONS_TOP, RANDOM_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.HumanPlayer.RandomizeDeployment(); } } }
/// <summary> /// Handles user input for the Deployment phase of the game. /// </summary> /// <remarks> /// Involves selecting the ships, deloying ships, changing the direction /// of the ships to add, randomising deployment, end then ending /// deployment /// </remarks> public static void HandleDeploymentInput() { if (SwinGame.KeyTyped(KeyCode.vk_ESCAPE)) { GameController.AddNewState(GameState.ViewingGameMenu); } if (SwinGame.KeyTyped(KeyCode.vk_UP) | SwinGame.KeyTyped(KeyCode.vk_DOWN)) { _currentDirection = Direction.UpDown; } if (SwinGame.KeyTyped(KeyCode.vk_LEFT) | SwinGame.KeyTyped(KeyCode.vk_RIGHT)) { _currentDirection = Direction.LeftRight; } if (SwinGame.KeyTyped(KeyCode.vk_b)) { _colour = ""; } if (SwinGame.KeyTyped(KeyCode.vk_g)) { _colour = "g"; } if (SwinGame.KeyTyped(KeyCode.vk_p)) { _colour = "p"; } if (SwinGame.KeyTyped(KeyCode.vk_r)) { GameController.HumanPlayer.RandomizeDeployment(); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { ShipName selected = default(ShipName); selected = GetShipMouseIsOver(); if (selected != ShipName.None) { _selectedShip = selected; } else { DoDeployClick(); } if (GameController.HumanPlayer.ReadyToDeploy & UtilityFunctions.IsMouseInRectangle(PLAY_BUTTON_LEFT, TOP_BUTTONS_TOP, PLAY_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.EndDeployment(); } else if (UtilityFunctions.IsMouseInRectangle(UP_DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.UpDown; } else if (UtilityFunctions.IsMouseInRectangle(LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.LeftRight; } else if (UtilityFunctions.IsMouseInRectangle(RANDOM_BUTTON_LEFT, TOP_BUTTONS_TOP, RANDOM_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.HumanPlayer.RandomizeDeployment(); } } }
/// <summary> /// MoveShips allows for ships to be placed on the seagrid /// </summary> /// <param name="row">the row selected</param> /// <param name="col">the column selected</param> /// <param name="ship">the ship selected</param> /// <param name="direction">the direction the ship is going</param> public void MoveShip(int row, int col, ShipName ship, Direction direction) { Ship newShip = _Ships[ship]; //@Issue2 @Lai Hoang Thanh Nguyen 16/09/2015 keep old position when ship location having error int oldRow = newShip.Row; int oldColumn = newShip.Column; Direction oldDirection = newShip.Direction; newShip.Remove(); AddShip(row, col, direction, newShip, oldDirection, oldRow, oldColumn); }
/// <summary> /// Handles user input for the Deployment phase of the game. /// </summary> /// <remarks> /// Involves selecting the ships, deloying ships, changing the direction /// of the ships to add, randomising deployment, end then ending /// deployment /// </remarks> public static void HandleDeploymentInput() { if (SwinGame.KeyTyped(KeyCode.vk_ESCAPE)) { GameController.AddNewState(GameState.ViewingGameMenu); } if (SwinGame.KeyTyped(KeyCode.vk_UP) | SwinGame.KeyTyped(KeyCode.vk_DOWN)) { _currentDirection = Direction.UpDown; } if (SwinGame.KeyTyped(KeyCode.vk_LEFT) | SwinGame.KeyTyped(KeyCode.vk_RIGHT)) { _currentDirection = Direction.LeftRight; } if (SwinGame.KeyTyped(KeyCode.vk_r)) { GameController.HumanPlayer.RandomizeDeployment(); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { ShipName selected = default(ShipName); selected = GetShipMouseIsOver(); if (selected != ShipName.None) { _selectedShip = selected; } else { DoDeployClick(); } //If player hits Ready to Play, Start the game. if (GameController.HumanPlayer.ReadyToDeploy & UtilityFunctions.IsMouseInRectangle(PLAY_BUTTON_LEFT, TOP_BUTTONS_TOP, PLAY_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.EndDeployment(); } //if the play clicks Up Arrow, change the orientation of the ships deployment else if (UtilityFunctions.IsMouseInRectangle(UP_DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.UpDown; } //if the player clicks the left/right arrow, chage the orientation ofthe ships deployment else if (UtilityFunctions.IsMouseInRectangle(LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.LeftRight; } //if randomise is clicked, randomise all the ships deployment else if (UtilityFunctions.IsMouseInRectangle(RANDOM_BUTTON_LEFT, TOP_BUTTONS_TOP, RANDOM_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.HumanPlayer.RandomizeDeployment(); } } }
/// <summary> /// Handles user input for the Deployment phase of the game. /// </summary> /// <remarks> /// Involves selecting the ships, deloying ships, changing the direction /// of the ships to add, randomising deployment, end then ending /// deployment /// </remarks> public static void HandleDeploymentInput() { if (SwinGame.KeyTyped(UtilityFunctions.EscapeKey)) { GameController.AddNewState(GameState.ViewingGameMenu); } if (SwinGame.KeyTyped(UtilityFunctions.UpKey) | SwinGame.KeyTyped(UtilityFunctions.DownKey)) { _currentDirection = Direction.UpDown; } if (SwinGame.KeyTyped(UtilityFunctions.LeftKey) | SwinGame.KeyTyped(UtilityFunctions.LeftKey)) { _currentDirection = Direction.LeftRight; } if (SwinGame.KeyTyped(UtilityFunctions.RandomKey)) { GameController.HumanPlayer.RandomizeDeployment(); } // ship colour change keys if (SwinGame.KeyTyped(UtilityFunctions.BlueKey)) { //GameController.CurrentShipColour = ShipColour.Blue; } if (SwinGame.KeyTyped(UtilityFunctions.PinkKey)) { //GameController.CurrentShipColour = ShipColour.Pink; } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { ShipName selected = default(ShipName); selected = GetShipMouseIsOver(); if (selected != ShipName.None) { _selectedShip = selected; } else { DoDeployClick(); } if (GameController.HumanPlayer.ReadyToDeploy & UtilityFunctions.IsMouseInRectangle (PLAY_BUTTON_LEFT, TOP_BUTTONS_TOP, PLAY_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.EndDeployment (); } else if (UtilityFunctions.IsMouseInRectangle (UP_DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.UpDown; } else if (UtilityFunctions.IsMouseInRectangle (LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.LeftRight; } else if (UtilityFunctions.IsMouseInRectangle (RANDOM_BUTTON_LEFT, TOP_BUTTONS_TOP, RANDOM_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.HumanPlayer.RandomizeDeployment (); } else if (UtilityFunctions.IsMouseInRectangle (PAINT_BUTTON_LEFT, TOP_BUTTONS_TOP, RANDOM_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { if (GameController.HumanPlayer.Ship (_selectedShip).CurrentShipColour == ShipColour.Pink) GameController.HumanPlayer.Ship (_selectedShip).CurrentShipColour = ShipColour.Blue; else GameController.HumanPlayer.Ship (_selectedShip).CurrentShipColour = ShipColour.Pink; } } }
public AttackResult(ResultOfAttack value, ShipName ship, string text, int row, int column) : this(value, text, row, column) { Ship = ship; }
/// <summary> /// MoveShips allows for ships to be placed on the seagrid /// </summary> /// <param name="row">the row selected</param> /// <param name="col">the column selected</param> /// <param name="ship">the ship selected</param> /// <param name="direction">the direction the ship is going</param> public void MoveShip(int row, int col, ShipName ship, Direction direction) { Ship newShip = _Ships[ship]; try { newShip.Remove(); AddShip(row, col, direction, newShip); } catch (Exception e) { AddShip(newShip.Row, newShip.Column, newShip.Direction, newShip); throw new ApplicationException(e.Message); } }
/// <summary> /// MoveShips allows for ships to be placed on the seagrid /// </summary> /// <param name="row">the row selected</param> /// <param name="col">the column selected</param> /// <param name="ship">the ship selected</param> /// <param name="direction">the direction the ship is going</param> public void MoveShip(int row, int col, ShipName ship, Direction direction) { Ship newShip = _Ships[ship]; //newShip.Remove(); Stops ships from dissapearing when clickingo on other ships during deployment AddShip(row, col, direction, newShip); }
/// <summary> /// MoveShips allows for ships to be placed on the seagrid /// </summary> /// <param name="row">the row selected</param> /// <param name="col">the column selected</param> /// <param name="ship">the ship selected</param> /// <param name="direction">the direction the ship is going</param> public void MoveShip(int row, int col, ShipName ship, Direction direction) { Ship newShip = _Ships [ship]; newShip.Remove(); AddShip(row, col, direction, newShip); }
/// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /// MoveShips allows for ships to be placed on the seagrid public void MoveShip(int row, int col, ShipName shipName, Direction direction) { Ship shipToMove = _shipList[shipName]; shipToMove.Remove(); AddShip(row, col, direction, shipToMove); }