コード例 #1
0
        public void PlaceShip(Vector space, bool horizontal)
        {
            if (ShipSelected == EnumShipList.None)
            {
                throw new BasicBlankException("Must have a ship selected in order to place the ship");
            }
            var thisShip = ShipList[(int)ShipSelected];

            thisShip.Visible = false;
            foreach (var thisPiece in thisShip.PieceList !.Values)
            {
                int nextShip = thisPiece.Index;
                _gameBoard1.PlaceShip(space, nextShip, out string Info);
                thisPiece.Location = Info;
                if (horizontal == true)
                {
                    space.Column++;
                }
                else
                {
                    space.Row++;
                }
            }
            ShipSelected = EnumShipList.None;
        }
コード例 #2
0
 public void ClearBoard()
 {
     ShipSelected = EnumShipList.None;
     foreach (var thisShip in ShipList.Values)
     {
         thisShip.Visible = true;
         foreach (var ThisPiece in thisShip.PieceList !.Values)
         {
             ThisPiece.DidHit   = false;
             ThisPiece.Location = "";
         }
     }
 }
コード例 #3
0
 public void ChooseShip(EnumShipList ship)
 {
     _viewModel.ShipSelected = ship; //looks like has to be put to that model which will notify this as well.
     _mainGame.GameBoard1.HumanWaiting();
 }