Пример #1
0
        static void Main(string[] args)
        {
            Player   player   = new Player();
            Window   window   = new Window(60, 50);
            Menu     menu     = new Menu(player);
            Admin    admin    = new Admin();
            World    world    = new World();
            Platform platform = new Platform();
            Game     game     = new Game();
            UI       ui       = new UI();

            Blocks actualBlock = game.RandomBlock();

            while (true)
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo key = Console.ReadKey();
                    menu.Start(key.Key, world, ui);
                    //admin.ConsolePos(key.Key);
                    //admin.ConsoleChangePos(key.Key , Console.CursorLeft , Console.CursorTop);

                    if (menu.IfStarted() && !game.IfLose(platform))
                    {
                        if (actualBlock.moveable && actualBlock.created)
                        {
                            actualBlock.Move(actualBlock.squares, key.Key, world, platform, player);
                        }
                    }

                    if (game.IfLose(platform))
                    {
                        game.PlayAgain(key.Key, world, platform, player);
                    }
                }
                //admin.ConsolePosShow(Console.CursorLeft , Console.CursorTop);
                if (menu.IfStarted() && !game.IfLose(platform))
                {
                    player.ChangePlayerLevel();
                    ui.ShowPlayerStatus(player);
                    platform.FullPlatform(player);
                    if (!actualBlock.created)
                    {
                        actualBlock.Create();
                    }
                }

                if (menu.IfStarted() && actualBlock.moveable && actualBlock.created && !game.IfLose(platform))
                {
                    if (actualBlock.gravityTime == 3)
                    {
                        actualBlock.Gravity(actualBlock.squares, world, platform);
                    }
                }


                if (!actualBlock.moveable && !game.IfLose(platform))
                {
                    actualBlock = game.RandomBlock();
                }

                if (game.IfLose(platform))
                {
                    game.Lose(player);
                }

                actualBlock.AddGravityTime();
                Thread.Sleep(150 / player.speed);
            }
        }