Esempio n. 1
0
        // 判定用の関数を作る必要があるか
        // 左右の動きによって判定ポイントが違う

        // TODO:処理が冗長なのでコンパクトにできないか検討
        // TODO:Move系全般に枠外に出ると範囲外でエラー
        /// <summary>
        /// テトリミノを右に移動させたときの処理
        /// </summary>
        public void CurrentTetriminoMoveRight()
        {
            Point position = _currentTetrimino.GetCurrentPosition();

            Point[] Shapes = _currentTetrimino.GetCurrentShape();
            bool    move   = true;

            CurrentTetriminoErase();
            foreach (Point Shape in Shapes)
            {
                if ((int)(Shape.X + position.X) + (((Cols / 2) - 1) + 1) >= Cols)
                {
                    move = false;
                    break;
                }
                else if (BlockControls[(int)(Shape.X + position.X) + ((Cols / 2) - 1 + 1),
                                       (int)(Shape.Y + position.Y) + 2].Background != NoBrush)
                {
                    move = false;
                    break;
                }
            }

            if (move)
            {
                _currentTetrimino.MoveRight();
                CurrentTetriminoDraw();
            }
            else
            {
                CurrentTetriminoDraw();
            }
        }
Esempio n. 2
0
        public void CurrentTetraminoMoveRight()
        {
            var position = _currentTetramino.GetCurrentPosition();
            var shape    = _currentTetramino.GetCurrentShape();
            var move     = true;

            CurrentTetraminoErase();
            foreach (var point in shape)
            {
                if (((int)(point.X + position.X) + ((_cols / 2) - 1) + 1) >= _cols)
                {
                    move = false;
                }
                else if (
                    !Equals(_blockControls[
                                ((int)(point.X + position.X) + ((_cols / 2) - 1) + 1), (int)(point.Y + position.Y) + 2]
                            .Background, NoBrush))
                {
                    move = false;
                }
            }

            if (move)
            {
                _currentTetramino.MoveRight();
                CurrentTetraminoDraw();
            }
            else
            {
                CurrentTetraminoDraw();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Фигуру вправо
        /// </summary>
        public void CurTetraminoMoveRight()
        {
            Point pos = currentTetramino.Position;

            Point[] figure = currentTetramino.Cells;
            TetrisField.TetraminoErase(currentTetramino);
            bool canMove = true;

            foreach (Point S in figure)
            {
                if (((int)(S.X + pos.X) + ((TetrisField.columns / 2) - 1) + 1) >= TetrisField.columns)
                {
                    canMove = false;
                }
                else if (TetrisField.Field[((int)(S.X + pos.X) + ((TetrisField.columns / 2) - 1) + 1),
                                           (int)(S.Y + pos.Y)].Fill != GridField.fieldBrush)
                {
                    canMove = false;
                }
            }
            if (canMove)
            {
                currentTetramino.MoveRight();
            }
            TetrisField.TetraminoDraw(currentTetramino);
        }