Ejemplo n.º 1
0
        private static void Pulse()
        {
            if (Console.KeyAvailable)
            {
                key      = Console.ReadKey();
                keyPulse = true;
            }
            else
            {
                keyPulse = false;
            }

            if (Program.key.Key == ConsoleKey.LeftArrow & !tetrimino.IsSomethLeft() & keyPulse)
            {
                for (int i = 0; i < 4; i++)
                {
                    tetrimino.position[i][1] -= 1;
                }
                Update();
            }
            else if (Program.key.Key == ConsoleKey.RightArrow & !tetrimino.IsSomethRight() & keyPulse)
            {
                for (int i = 0; i < 4; i++)
                {
                    tetrimino.position[i][1] += 1;
                }
                Update();
            }
            if (Program.key.Key == ConsoleKey.DownArrow & keyPulse)
            {
                tetrimino.Solve();
            }
            if (Program.key.Key == ConsoleKey.DownArrow & keyPulse)
            {
                for (; tetrimino.IsSomthBelow() != true;)
                {
                    tetrimino.Solve();
                }
            }
            if (Program.key.Key == ConsoleKey.UpArrow & keyPulse)
            {
                tetrimino.Rotate();
                tetrimino.Update();
            }
        }