public MyCube(float size, MyCubeTexture tex) { textureID = texturesCollection[(int)tex]; leftBottomBack = new float[] { -1.0f, -1.0f, -1.0f }; rightBottomBack = new float[] { 1.0f, -1.0f, -1.0f }; leftTopBack = new float[] { -1.0f, 1.0f, -1.0f }; rightTopBack = new float[] { 1.0f, 1.0f, -1.0f }; leftBottomFront = new float[] { -1.0f, -1.0f, 1.0f }; rightBottomFront = new float[] { 1.0f, -1.0f, 1.0f }; leftTopFront = new float[] { -1.0f, 1.0f, 1.0f }; rightTopFront = new float[] { 1.0f, 1.0f, 1.0f }; width = size / 2; for (int i = 0; i < 3; i++) { leftBottomBack[i] *= width; rightBottomBack[i] *= width; leftTopBack[i] *= width; rightTopBack[i] *= width; leftBottomFront[i] *= width; rightBottomFront[i] *= width; leftTopFront[i] *= width; rightTopFront[i] *= width; } }
protected BaseBlock(int startWidthIndex, ref GameBoardCell[,] gameBoard, int bW, MyCubeTexture texture) { actualTexture = texture; this.gameBoard = gameBoard; boardWidth = bW; boardHeight = 2 * bW - 1; usedCells = new Dictionary <int, Tuple <int, int> >(); }
/// <summary> /// creates water O-block at top of gameboard /// </summary> /// <param name="startWidthIndex">index for left top corner in game board</param> /// <param name="bW">game board width</param> /// <param name="bH">game board height</param> public OBlock(int startWidthIndex, ref GameBoardCell[,] gameBoard, int bW, MyCubeTexture texture) : base(startWidthIndex, ref gameBoard, bW, texture) { base.usedCells.Add(0, new Tuple <int, int>(startWidthIndex, boardHeight - 1)); //Block indexes layout base.usedCells.Add(1, new Tuple <int, int>(startWidthIndex + 1, boardHeight - 1)); // 0 1 base.usedCells.Add(2, new Tuple <int, int>(startWidthIndex, boardHeight - 2)); // 2 3 base.usedCells.Add(3, new Tuple <int, int>(startWidthIndex + 1, boardHeight - 2)); TakeCells(); }
public TBlock(int startWidthIndex, ref GameBoardCell[,] gameBoard, int bW, MyCubeTexture texture) : base(startWidthIndex - 2, ref gameBoard, bW, texture) { actualPosition = Position.Bottom; usedCells.Add(0, new Tuple <int, int>(startWidthIndex - 1, boardHeight - 2)); //Block indexes layout usedCells.Add(1, new Tuple <int, int>(startWidthIndex, boardHeight - 1)); // 1 usedCells.Add(2, new Tuple <int, int>(startWidthIndex, boardHeight - 2)); // 0 2 3 usedCells.Add(3, new Tuple <int, int>(startWidthIndex + 1, boardHeight - 2)); TakeCells(); }