예제 #1
0
        public bool MakeSingleShoot(List <Ship> listofenemyships, CellProperty[,] enemywarmap)
        {
            bool[] result = { false, false };

            do
            {
                Console.Clear();
                ActionGameUI.DrawBoardWar(enemywarmap);
                Console.WriteLine();
                Console.WriteLine("Podaj koordynaty");
                string input = Console.ReadLine();

                int[] coordinates = new InputParser().ChangeCordsToIndexes(input);
                War   war         = new War();
                result = war.Shoot(coordinates, enemywarmap, listofenemyships);
            } while (result[0] == false);

            ActionGameUI.DrawBoardWar(enemywarmap);

            return(result[1]);
        }
예제 #2
0
        public (CellProperty[, ], CellProperty[, ]) PlaceShips()
        {
            string placement = "", direction;

            while (AllShipsPlaced == false)
            {
                if (NextPlayer == false)
                {
                    UserCommunication(out placement, out direction, "First");
                    PlayerOneBoard = PlaceShipOnBoard(PlayerOneBoard, placement, direction);

                    ActionGameUI.DrawBoard(PlayerOneBoard);

                    if (CounterOfShipsPlaced == 7)
                    {
                        CounterOfShipsPlaced = 0;
                        NextPlayer           = true;
                        AnyKeyToContinue();
                        ActionGameUI.DrawBoard(PlayerTwoBoard);
                    }
                }
                else
                {
                    UserCommunication(out placement, out direction, "Second");
                    PlayerTwoBoard = PlaceShipOnBoard(PlayerTwoBoard, placement, direction);
                    ActionGameUI.DrawBoard(PlayerTwoBoard);

                    if (CounterOfShipsPlaced == 7)
                    {
                        AllShipsPlaced = true;
                    }
                }
            }

            AnyKeyToContinue();
            return(PlayerOneBoard, PlayerTwoBoard);
        }
예제 #3
0
 static void Main(string[] args)
 {
     ActionGameUI.DisplayUI();
 }