Ejemplo n.º 1
0
 private void button_GeneretaRandom_Click(object sender, EventArgs e)
 {
     FieldGenerator.GenerateRandomField(ref game.Player.board, ref game.Player.ships);
     button1.Enabled = true;
     //InitGrid(enemyGrid);
     //Drawer.DrawPlayerBoard(game.Player.EnemyBoard, enemyGrid);
     Drawer.DrawPlayerBoard(game.Player.Board, gridPlayer);
 }
Ejemplo n.º 2
0
        public void StartGame()
        {
            CurrentStage = Stage.GAME; //игра начинается
            Random rnd = new Random();

            Player.ShipPartsNumber   = FieldGenerator.CountShipParts(Player.Ships); //количество живых частей корабля
            Computer.ShipPartsNumber = FieldGenerator.CountShipParts(Computer.Ships);
            CurrentTurn = Turn.COMPUTER;
        }
Ejemplo n.º 3
0
        public ComputerPlayer()
        {
            InitializeBoards();
            AvailablePointForShooting = new List <Point>();
            Ships = new List <Ship>();

            FieldGenerator.GenerateRandomField(ref board, ref ships);

            for (int i = 0; i < Settings.FIELD_SIZE; i++)
            {
                for (int j = 0; j < Settings.FIELD_SIZE; j++)
                {
                    AvailablePointForShooting.Add(new Point(i, j));
                }
            }

            rnd = new Random();
            SelectNextTargetPoint();
        }
Ejemplo n.º 4
0
 private bool SetShip(int gridX, int gridY, Ship ship)
 {
     return(FieldGenerator.SetShip(game.Player.Board, game.Player.Ships, new Ship(gridX, gridY, CurrentShipLength, CurrentShipPosition)));
     //return game.Player.SetShip(new Ship(gridX, gridY, CurrentShipLength, CurrentShipPosition));
 }