Exemplo n.º 1
0
        void GetRandomBlock()
        {
            int RandomPosition = rand.Next(0, 4);

            switch (RandomBlock)
            {
            case 0:
                t_block   = new T_Block(StartPoint, RandomPosition, BlockSize, board);
                moveLeft  = t_block.MoveLeft;
                moveRight = t_block.MoveRight;
                moveDown  = t_block.MoveDown;
                rotate    = t_block.Rotate;

                BlockColor        = t_block.color;
                returnCoordinates = t_block.returnCoordinates;

                break;

            case 1:
                square    = new Square(StartPoint, BlockSize, board);
                moveLeft  = square.MoveLeft;
                moveRight = square.MoveRight;
                moveDown  = square.MoveDown;
                rotate    = square.Rotate;

                BlockColor        = square.color;
                returnCoordinates = square.returnCoordinates;

                break;

            case 2:
                stick     = new Stick(StartPoint, RandomPosition, BlockSize, board);
                moveLeft  = stick.MoveLeft;
                moveRight = stick.MoveRight;
                moveDown  = stick.MoveDown;
                rotate    = stick.Rotate;

                BlockColor        = stick.color;
                returnCoordinates = stick.returnCoordinates;

                break;

            case 3:
                z_block   = new Z_Block(StartPoint, RandomPosition, BlockSize, board);
                moveLeft  = z_block.MoveLeft;
                moveRight = z_block.MoveRight;
                moveDown  = z_block.MoveDown;
                rotate    = z_block.Rotate;

                BlockColor        = z_block.color;
                returnCoordinates = z_block.returnCoordinates;
                break;

            //
            default:
                break;
            }
        }
Exemplo n.º 2
0
        void GetRandomBlock()
        {
            int RandomPosition = rand.Next(0, 4);

            switch (RandomBlock)
            {
                case 0:
                    t_block = new T_Block(StartPoint, RandomPosition, BlockSize,board);
                    moveLeft = t_block.MoveLeft;
                    moveRight = t_block.MoveRight;
                    moveDown = t_block.MoveDown;
                    rotate = t_block.Rotate;

                    BlockColor = t_block.color;
                    returnCoordinates = t_block.returnCoordinates;

                    break;
                case 1:
                    square = new Square(StartPoint, BlockSize,board);
                    moveLeft = square.MoveLeft;
                    moveRight = square.MoveRight;
                    moveDown = square.MoveDown;
                    rotate = square.Rotate;

                    BlockColor = square.color;
                    returnCoordinates = square.returnCoordinates;

                    break;
                case 2:
                    stick = new Stick(StartPoint, RandomPosition, BlockSize,board);
                    moveLeft = stick.MoveLeft;
                    moveRight = stick.MoveRight;
                    moveDown = stick.MoveDown;
                    rotate = stick.Rotate;

                    BlockColor = stick.color;
                    returnCoordinates = stick.returnCoordinates;

                    break;
                case 3:
                    z_block = new Z_Block(StartPoint, RandomPosition, BlockSize,board);
                    moveLeft = z_block.MoveLeft;
                    moveRight = z_block.MoveRight;
                    moveDown = z_block.MoveDown;
                    rotate = z_block.Rotate;

                    BlockColor = z_block.color;
                    returnCoordinates = z_block.returnCoordinates;
                    break;
                //
                default:
                    break;

            }
        }
Exemplo n.º 3
0
        Bitmap DrawRandomBlock()
        {
            Bitmap  RandomDraft = new Bitmap(RandomBSheet.Width, RandomBSheet.Height);
            Painter @Painter    = new Painter(RandomDraft, BlockSize, RandomDraft.Width, RandomDraft.Height);

            int RandomPosition = rand.Next(0, 4);

            Color RColor = Color.FromArgb(40, 40, 40);

            Point Position = new Point(2 * BlockSize, 2 * BlockSize);

            switch (RandomBlock)
            {
            case 0:
                t_block = new T_Block(RandomDraft, Position, RandomPosition, BlockSize);
                t_block.Draw();
                @Painter.DrawArea(RColor);
                return(RandomDraft);

            case 1:
                square = new Square(RandomDraft, Position, BlockSize);
                square.Draw();
                @Painter.DrawArea(RColor);
                return(RandomDraft);

            case 2:
                stick = new Stick(RandomDraft, Position, RandomPosition, BlockSize);
                stick.Draw();
                @Painter.DrawArea(RColor);
                return(RandomDraft);

            case 3:
                z_block = new Z_Block(RandomDraft, Position, RandomPosition, BlockSize);
                z_block.Draw();
                @Painter.DrawArea(RColor);
                return(RandomDraft);

            default:
                return(RandomDraft);
            }
        }
Exemplo n.º 4
0
        Bitmap DrawRandomBlock()
        {
            Bitmap RandomDraft = new Bitmap(RandomBSheet.Width, RandomBSheet.Height);
            Painter @Painter = new Painter(RandomDraft, BlockSize, RandomDraft.Width, RandomDraft.Height);

            int RandomPosition = rand.Next(0, 4);

            Color RColor = Color.FromArgb(40, 40, 40);

            Point Position = new Point(2 * BlockSize, 2 * BlockSize);

            switch(RandomBlock)
            {
                case 0:
                    t_block = new T_Block(RandomDraft, Position, RandomPosition, BlockSize);
                    t_block.Draw();
                    @Painter.DrawArea(RColor);
                    return RandomDraft;
                case 1:
                    square = new Square(RandomDraft, Position, BlockSize);
                    square.Draw();
                    @Painter.DrawArea(RColor);
                    return RandomDraft;
                case 2:
                    stick = new Stick(RandomDraft, Position, RandomPosition, BlockSize);
                    stick.Draw();
                    @Painter.DrawArea(RColor);
                    return RandomDraft;
                case 3:
                    z_block = new Z_Block(RandomDraft, Position, RandomPosition, BlockSize);
                    z_block.Draw();
                    @Painter.DrawArea(RColor);
                    return RandomDraft;
                default:
                    return RandomDraft;
            }
        }