Пример #1
0
        public NotMatrix(Grid NotaMatrix)
        {
            rows     = NotaMatrix.RowDefinitions.Count;
            columns  = NotaMatrix.ColumnDefinitions.Count;
            score    = 0;
            lines    = 0;
            level    = 1;
            gameover = false;

            controllers = new Label[columns, rows];
            for (int i = 0; i < columns; i++)
            {
                for (int j = 0; j < rows; j++)
                {
                    controllers[i, j] = new Label();
                    Grid.SetRow(controllers[i, j], j);
                    Grid.SetColumn(controllers[i, j], i);
                    NotaMatrix.Children.Add(controllers[i, j]);
                }
            }
            currentMino = new NotaMino();
            DrawCurrMino();
        }
Пример #2
0
        public void MinoMoveDown()
        {
            Point minoPos = currentMino.GetMinoPos();

            Point[] minoShape = currentMino.GetMinoShape();
            bool    move      = true;

            DeleteMino();

            foreach (Point block in minoShape)
            {
                if (((int)(block.Y + minoPos.Y) + 2 + 1) >= rows)
                {
                    move = false;
                }
                else if (controllers[((int)(block.X + minoPos.X) + ((columns / 2) - 1)), (int)(block.Y + minoPos.Y) + 2 + 1].Background != nothing)
                {
                    move = false;
                    if (((int)(block.Y + minoPos.Y) + 2 + 1) <= 1)
                    {
                        gameover = true;
                    }
                }
            }
            if (move)
            {
                currentMino.MoveDown();
                DrawCurrMino();
            }
            else
            {
                DrawCurrMino();
                RowCheck();
                currentMino = new NotaMino();
            }
        }