Esempio n. 1
0
 public GameState()                                            // При создании класса инициализировать все игровый объекты
 {
     Console.CursorVisible = false;
     Console.SetWindowSize(40, 35);
     Console.SetBufferSize(40, 35);
     //Console.SetWindowPosition(40, 40);
     walls = new Wall('#', LevelNumber, new List <ConsoleColor> {
         ConsoleColor.Red, ConsoleColor.Red
     });
     IntFace = new GameInterface(walls.PointToGet);
     snake   = new Serpent('0', 20, 10, new List <ConsoleColor> {
         ConsoleColor.Green, ConsoleColor.DarkGreen
     });
     food = new Food('@', new List <Objects> {
         snake, walls
     }, new List <ConsoleColor> {
         ConsoleColor.Yellow, ConsoleColor.Yellow
     });
 }
Esempio n. 2
0
        // Перезапуск игры
        public void RestartGame()
        {
            timer = new Timer(200);
            walls = new Wall('#', LevelNumber, new List <ConsoleColor> {
                ConsoleColor.Red, ConsoleColor.Red
            });
            string PlayerName = IntFace.GetName;

            IntFace         = new GameInterface(walls.PointToGet);
            IntFace.GetName = PlayerName;
            snake           = new Serpent('0', 20, 10, new List <ConsoleColor> {
                ConsoleColor.Green, ConsoleColor.DarkGreen
            });
            food = new Food('@', new List <Objects> {
                snake, walls
            }, new List <ConsoleColor> {
                ConsoleColor.Yellow, ConsoleColor.Yellow
            });
            _continue = true;
            Console.Clear();
            DrawScene();
            StartGame();
        }