Exemple #1
0
        public GameState()
        {
            food    = new Food('$', ConsoleColor.Green);
            serpent = new Serpent('o', ConsoleColor.Red);
            wall    = new Wall('#', ConsoleColor.Blue);

            Console.SetWindowSize(40, 40);
            Console.SetBufferSize(40, 40);
            Console.CursorVisible = false;
        }
Exemple #2
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
     });
 }
Exemple #3
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();
        }