Beispiel #1
0
        public void Play()
        {
            // Wait on pairings
            Ship[] ships  = new Ship[5];
            bool   placed = false;

            for (int i = 0; i < ships.Length; i++)
            {
                placed = false;
                if (i < 2)
                {
                    ships[i] = new Minesweeper(1, 1, true, yourMap);
                }
                else if (i < 3)// Feel the magic
                {
                    ships[i] = new Frigate(1, 1, true, yourMap);
                }
                else if (i < 4)
                {
                    ships[i] = new Cruiser(1, 1, true, yourMap);
                }
                else if (i < 5)
                {
                    ships[i] = new Battleship(1, 1, true, yourMap);
                }
                ships[i].Draw();
                while (!placed)
                {
                    ConsoleKey key = (ConsoleKey)Console.ReadKey(true).Key;
                    placed = ships[i].MoveShip(key);
                }
                // Place ships
            }

            shipsPlaced = true;

            foreach (Ship s in ships)
            {
                s.Draw();
            }
            // Send map to server
            while (true)
            {
                // Place coordinate on enemy map
                // Send point bto server
                // Recieve hit
                // Recieve enemy hit
                // If enemy ships/your ships destroyed - Break
            }
        }
Beispiel #2
0
        public void Play()
        {
            // Wait on pairings
            Ship[] ships = new Ship[5];
            bool placed = false;
            for (int i = 0; i < ships.Length; i++ )
            {
                placed = false;
                if (i < 2)
                {
                    ships[i] = new Minesweeper(1, 1, true, yourMap);
                }
                else if (i < 3)// Feel the magic
                {
                    ships[i] = new Frigate(1, 1, true, yourMap);
                }
                else if (i < 4)
                {
                    ships[i] = new Cruiser(1, 1, true, yourMap);
                }
                else if (i < 5)
                {
                    ships[i] = new Battleship(1, 1, true, yourMap);
                }
                ships[i].Draw();
                while (!placed)
                {
                    ConsoleKey key = (ConsoleKey)Console.ReadKey(true).Key;
                    placed = ships[i].MoveShip(key);
                }
                // Place ships
            }

            shipsPlaced = true;

            foreach (Ship s in ships)
            {
                s.Draw();
            }
            // Send map to server
            while (true)
            {
                // Place coordinate on enemy map
                // Send point bto server
                // Recieve hit
                // Recieve enemy hit
                // If enemy ships/your ships destroyed - Break
            }
        }