Пример #1
0
 private void ShowPlayerStat()
 {
     Console.SetCursorPosition(0, GameField.GetHeight() + 11);
     ShowHorizontalBoardLine(0, this.width);
     Console.WriteLine();
     ShowVerticalBoardLine(2, 0, this.width - 1);
     ShowHorizontalBoardLine(0, this.width);
     Console.SetCursorPosition(this.width / 3, Console.CursorTop - 2);
     Console.Write(player.GetName());
     Console.SetCursorPosition(this.width / 3, Console.CursorTop + 1);
     Console.Write("Level: " + level.ToString("000"));
 }
Пример #2
0
        private void ClearLine()
        {
            int combo = 0;

            for (int i = 0; i < GameField.GetHeight(); i++)
            {
                int j;
                for (j = 0; j < GameField.GetWidth(); j++)
                {
                    if (GameField.GetDroppedShapeLocationGrid()[i, j] == 0)
                    {
                        break;
                    }
                }

                if (j == GameField.GetWidth())
                {
                    linesPicked++;
                    combo++;
                    ShowLineBlock();

                    for (j = 0; j < GameField.GetWidth(); j++)
                    {
                        GameField.GetDroppedShapeLocationGrid()[i, j] = 0;
                    }

                    int[,] newDroppedShapeLocationGrid = new int[GameField.GetHeight(), GameField.GetWidth()];
                    for (int k = 1; k < i; k++)
                    {
                        for (int l = 0; l < GameField.GetWidth(); l++)
                        {
                            newDroppedShapeLocationGrid[k + 1, l] = GameField.GetDroppedShapeLocationGrid()[k, l];
                        }
                    }

                    for (int k = 1; k < i; k++)
                    {
                        for (int l = 0; l < GameField.GetWidth(); l++)
                        {
                            GameField.GetDroppedShapeLocationGrid()[k, l] = 0;
                        }
                    }

                    for (int k = 0; k < GameField.GetHeight(); k++)
                    {
                        for (int l = 0; l < GameField.GetWidth(); l++)
                        {
                            if (newDroppedShapeLocationGrid[k, l] == 1)
                            {
                                GameField.GetDroppedShapeLocationGrid()[k, l] = 1;
                            }
                        }
                    }
                    GameField.DrawShape(this.shape);

                    if (combo == 1)
                    {
                        this.player.SetScore(this.player.GetScore() + 100);
                    }
                    else if (combo == 2)
                    {
                        this.player.SetScore(this.player.GetScore() + 300);
                    }
                    else if (combo == 3)
                    {
                        this.player.SetScore(this.player.GetScore() + 700);
                    }
                    else if (combo > 3)
                    {
                        this.player.SetScore(this.player.GetScore() + 1500);
                    }
                    ShowScoreBlock();

                    if (linesPicked < 5)
                    {
                        level = 1;
                    }
                    else if (linesPicked < 10)
                    {
                        level = 2;
                    }
                    else if (linesPicked < 15)
                    {
                        level = 3;
                    }
                    else if (linesPicked < 25)
                    {
                        level = 4;
                    }
                    else if (linesPicked < 35)
                    {
                        level = 5;
                    }
                    else if (linesPicked < 50)
                    {
                        level = 6;
                    }
                    else if (linesPicked < 70)
                    {
                        level = 7;
                    }
                    else if (linesPicked < 90)
                    {
                        level = 8;
                    }
                    else if (linesPicked < 110)
                    {
                        level = 9;
                    }
                    else if (linesPicked < 150)
                    {
                        level = 10;
                    }
                    ShowPlayerStat();
                }
            }
            dropRate = 300 - 22 * level;
        }