Пример #1
0
 protected override void LoadContent()
 {
     spriteBatch  = new SpriteBatch(GraphicsDevice);
     soundControl = new SoundControl(Content);
     gameControl  = new GameControl(this, graphics);
     gameControl.MainMenu();
 }
Пример #2
0
        public GameArea(Stats.Stats stats, ContentManager content, SoundControl soundControl)
        {
            texture      = content.Load <Texture2D>("field");
            bgPosition   = new Vector2(X + OFFSET_X, Y + OFFSET_Y);
            slots        = new BlockSlot[WIDTH, HEIGHT];
            this.content = content;
            this.stats   = stats;

            for (int i = 0; i < WIDTH; i++)
            {
                for (int j = 0; j < HEIGHT; j++)
                {
                    slots[i, j] = new BlockSlot(i, j, X, Y);
                }
            }

            tetrimino = new Tetrimino(Tetrimino.GenerateType(null), content, soundControl);
            PrepareNextTetrimino();
            canHold           = true;
            this.soundControl = soundControl;
        }
Пример #3
0
        public Tetrimino(int type, ContentManager content, SoundControl soundControl)
        {
            this.type    = (TetriminoType)type;
            position     = new Vector2(START_X, START_Y);
            blocks       = new Block[4, 4];
            times        = new double[3];
            falling      = true;
            this.content = content;

            byte[,] shape = GetShape(type);
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    if (shape[i, j] == 1)
                    {
                        blocks[i, j] = new Block(GetColor(type), content);
                    }
                }
            }

            this.soundControl = soundControl;
        }