public static ByteArray2D Repeat(int w, int h, byte value) { var arr = new ByteArray2D(w, h); for (var x = 0; x < w; x++) { for (var y = 0; y < h; y++) { arr[x, y] = value; } } return(arr); }
/// <summary> /// 重新设置物体图块数组大小,将丢失已有数据 /// </summary> /// <param name="width"></param> /// <param name="height"></param> /// <param name="depth"></param> public void ResizeBlocksArray(int width, int height, int depth) { this.blocks = new ByteArray3D(); for (int x = 0; x < width; x++) { ByteArray2D byteArray2D = new ByteArray2D(); for (int y = 0; y < height; y++) { ByteArray byteArray = new ByteArray(); for (int z = 0; z < depth; z++) { byteArray.Add(0); } byteArray2D.Add(byteArray); } this.blocks.Add(byteArray2D); } }