我正在通过制作一个俄罗斯方块游戏来学习C#,下面是一个3d数组,它代表一个Tetromino及其四个旋转,我想为其中的2d数组之一分配一个变量。我习惯使用JavaScript,无法弄清语法。
int[][][] T = new int[][][]
{
new int[][] {
new int[]{0,1,0},
new int[]{1,1,1},
new int[]{0,0,0}
},
new int[][]{
new int[]{0,1,0},
new int[]{0,1,1},
new int[]{0,1,0}
},
new int[][]{
new int[]{0,0,0},
new int[]{1,1,1},
new int[]{0,1,0},
},
new int[][]{
new int[]{0,1,0},
new int[]{1,1,0},
new int[]{0,1,0}
}
};
int position = 0;
//this is what i would like to do but it throws a error
int[][] activePiece = T[position];
//example in javascript
//const activePiece = T[position]
//and activePiece would equal
//[[0,1,0]
//[1,1,1]
//[0,0,0]]