Пример #1
0
        public void ResumeCooperativeGame()
        {
            Beginning();

            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.SetCursorPosition(55, 12);
            string FirstPlayer = Console.ReadLine();

            Console.ForegroundColor = ConsoleColor.Magenta;
            Console.SetCursorPosition(45, 14);
            Console.WriteLine("Enter Second Player's Nickname:");
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.SetCursorPosition(55, 15);
            string SecondPlayer = Console.ReadLine();
            string fileName     = FirstPlayer + SecondPlayer + ".xml";

            if (File.Exists(fileName))
            {
                List <GameObject> ContinueGameObjects = Deserialize(fileName);

                CooperativeGame ContinueGame = new CooperativeGame(ContinueGameObjects, FirstPlayer, SecondPlayer);
                Console.Clear();
                ContinueGame.Start();
            }

            else
            {
                NoSavedGames();
            }
        }
Пример #2
0
        public void PlayCooperativeGame()
        {
            Beginning();

            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.SetCursorPosition(55, 12);
            string FirstPlayer = Console.ReadLine();

            Console.ForegroundColor = ConsoleColor.Magenta;
            Console.SetCursorPosition(45, 14);
            Console.WriteLine("Enter Second Player's Nickname:");
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.SetCursorPosition(55, 15);
            string SecondPlayer = Console.ReadLine();

            Snake           FirstSnake  = new Snake(3, 2, 'o', ConsoleColor.Magenta, 'O', 0);
            Snake           SecondSnake = new Snake(116, 2, 'o', ConsoleColor.DarkGray, 'O', 0);
            Food            food        = new Food(0, 0, '*', ConsoleColor.Cyan);
            Wall            wall        = new Wall('#', ConsoleColor.DarkYellow);
            CooperativeGame game        = new CooperativeGame(FirstPlayer, SecondPlayer, FirstSnake, SecondSnake, food, wall);

            Console.Clear();
            game.Start();
        }