Пример #1
0
        public bool PlaceFleet(Board board1, Board board2, int fleetCap, int shipSize, string gmSassyRemark)
        {
            var shipsLeftToPlace = fleetCap;

            Console.Write("Coordinates [x-y]: ");
            while (shipsLeftToPlace != 0)
            {
                var input = _consoleMicroservice.GetInput("Invalid coordinates. Ships must be within the field of operations. Try again mate.\n");

                if (input.ToLower() == "r")
                {
                    _consoleMicroservice.GameMasterSpeech(gmSassyRemark);
                    board1 = PlaceShipsRandomly(board1, shipSize, shipsLeftToPlace);

                    _consoleMicroservice.RadarOperatorAlliedBoard(board1.Owner.Name);
                    _consoleMicroservice.ShowBattleMap(board1.Owner, board1, ConsoleColor.Cyan, "[Current Allied Ship Positions]:\n");

                    return(true);
                }

                var result = PlaceShip(board1, input, shipSize);
                if (result)
                {
                    shipsLeftToPlace = shipsLeftToPlace - 1;
                    _consoleMicroservice.ShipInPosition(shipsLeftToPlace, board1.Owner.Name);
                }
                else
                {
                    _consoleMicroservice.GameMasterSpeech("Invalid coordinates. Put your ship within the board.\n");
                }

                _consoleMicroservice.RadarOperatorAlliedBoard(board1.Owner.Name);
                _consoleMicroservice.ShowBattleMap(board1.Owner, board1, ConsoleColor.Cyan, "[Current Allied Ship Positions]:\n");
            }

            return(true);
        }
Пример #2
0
 public void Introductions()
 {
     Console.ForegroundColor = ConsoleColor.DarkYellow;
     _consoleMicroservice.GameMasterSpeech("Welcome to TK's Battleship Arena! Behold!\n");
     _consoleMicroservice.GameMasterSpeech("The mightiest C# console navy fleets brawl with each other on the high seas!\n");
     _consoleMicroservice.GameMasterSpeech("First, setup.\n");
     (_player1, _player2, _board1, _board2, _gameMode) = _boardService.SetupPvPBoards();
 }