public override void Rotate(BlockController bc) { if (cells[1].X == 0 && CommonData.CommonArr[cells[0].X + 1, cells[0].Y] == 0 && CommonData.CommonArr[cells[0].X + 2, cells[0].Y] == 0 && CommonData.CommonArr[cells[1].X + 1, cells[1].Y] == 0 && CommonData.CommonArr[cells[1].X + 2, cells[1].Y] == 0 && CommonData.CommonArr[cells[3].X + 1, cells[3].Y] == 0) { CommonData.CommonArr[cells[3].X + 1, cells[3].Y + 2] = CommonData.CommonArr[cells[3].X, cells[3].Y]; CommonData.CommonArr[cells[3].X, cells[3].Y] = 0; CommonData.CommonArr[cells[2].X + 2, cells[2].Y + 1] = CommonData.CommonArr[cells[2].X, cells[2].Y]; CommonData.CommonArr[cells[2].X, cells[2].Y] = 0; CommonData.CommonArr[cells[1].X + 1, cells[1].Y] = CommonData.CommonArr[cells[2].X, cells[2].Y]; CommonData.CommonArr[cells[1].X, cells[1].Y] = 0; CommonData.CommonArr[cells[0].X, cells[0].Y - 1] = CommonData.CommonArr[cells[0].X, cells[0].Y]; CommonData.CommonArr[cells[0].X, cells[0].Y] = 0; cells[3].Y += 2; cells[3].X += 1; cells[2].X += 2; cells[2].Y += 1; cells[1].X += 1; cells[0].Y -= 1; Cell c_0 = new Cell(cells[0].X, cells[0].Y, 4); Cell c_1 = new Cell(cells[1].X, cells[1].Y, 4); Cell c_2 = new Cell(cells[2].X, cells[2].Y, 4); Cell c_3 = new Cell(cells[3].X, cells[3].Y, 4); Element_four_State__3 element_four_State__3 = new Element_four_State__3(c_0, c_1, c_2, c_3); bc.stateBlockTetris = element_four_State__3; } if (cells[0].X >= 1 && CommonData.CommonArr[cells[0].X - 1, cells[0].Y] == 0 && CommonData.CommonArr[cells[1].X - 1, cells[1].Y] == 0 && CommonData.CommonArr[cells[0].X + 1, cells[0].Y] == 0 && CommonData.CommonArr[cells[1].X + 1, cells[1].Y] == 0) { CommonData.CommonArr[cells[3].X, cells[3].Y + 2] = CommonData.CommonArr[cells[3].X, cells[3].Y]; CommonData.CommonArr[cells[3].X, cells[3].Y] = 0; CommonData.CommonArr[cells[2].X + 1, cells[2].Y + 1] = CommonData.CommonArr[cells[2].X, cells[2].Y]; CommonData.CommonArr[cells[2].X, cells[2].Y] = 0; CommonData.CommonArr[cells[0].X - 1, cells[0].Y - 1] = CommonData.CommonArr[cells[0].X, cells[0].Y]; CommonData.CommonArr[cells[0].X, cells[0].Y] = 0; cells[3].Y += 2; cells[2].X += 1; cells[2].Y += 1; cells[0].X -= 1; cells[0].Y -= 1; Cell c_0 = new Cell(cells[0].X, cells[0].Y, 4); Cell c_1 = new Cell(cells[1].X, cells[1].Y, 4); Cell c_2 = new Cell(cells[2].X, cells[2].Y, 4); Cell c_3 = new Cell(cells[3].X, cells[3].Y, 4); Element_four_State__3 element_four_State__3 = new Element_four_State__3(c_0, c_1, c_2, c_3); bc.stateBlockTetris = element_four_State__3; } }
public StateBlockTetris GeneretedSBT(int RandNum) { StateBlockTetris stateBlockTetris = null; if (RandNum == 1) { Cell c_0_rand_1 = new Cell(0, 1, 1); Cell c_1_rand_1 = new Cell(0, 2, 1); Cell c_2_rand_1 = new Cell(0, 3, 1); Cell c_3_rand_1 = new Cell(0, 4, 1); stateBlockTetris = new Horizontal(c_0_rand_1, c_1_rand_1, c_2_rand_1, c_3_rand_1); } if (RandNum == 2) { if ( CommonData.CommonArr[0, 2] > 0 && CommonData.CommonArr[1, 2] > 0 && CommonData.CommonArr[2, 2] > 0 && CommonData.CommonArr[3, 2] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_2 = new Cell(0, 2, 1); Cell c_1_rand_2 = new Cell(1, 2, 1); Cell c_2_rand_2 = new Cell(2, 2, 1); Cell c_3_rand_2 = new Cell(3, 2, 1); stateBlockTetris = new Vertical(c_0_rand_2, c_1_rand_2, c_2_rand_2, c_3_rand_2); } if (RandNum == 3) { if ( CommonData.CommonArr[2, 2] > 0 && CommonData.CommonArr[1, 2] > 0 && CommonData.CommonArr[0, 2] > 0 && CommonData.CommonArr[0, 3] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_3 = new Cell(2, 2, 2); Cell c_1_rand_3 = new Cell(1, 2, 2); Cell c_2_rand_3 = new Cell(0, 2, 2); Cell c_3_rand_3 = new Cell(0, 3, 2); stateBlockTetris = new Element_two_State__1(c_0_rand_3, c_1_rand_3, c_2_rand_3, c_3_rand_3); } if (RandNum == 4) { if ( CommonData.CommonArr[0, 1] > 0 && CommonData.CommonArr[0, 2] > 0 && CommonData.CommonArr[0, 3] > 0 && CommonData.CommonArr[1, 3] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_4 = new Cell(0, 1, 2); Cell c_1_rand_4 = new Cell(0, 2, 2); Cell c_2_rand_4 = new Cell(0, 3, 2); Cell c_3_rand_4 = new Cell(1, 3, 2); stateBlockTetris = new Element_two_State__2(c_0_rand_4, c_1_rand_4, c_2_rand_4, c_3_rand_4); } if (RandNum == 5) { if ( CommonData.CommonArr[0, 3] > 0 && CommonData.CommonArr[1, 3] > 0 && CommonData.CommonArr[2, 3] > 0 && CommonData.CommonArr[2, 2] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_5 = new Cell(0, 3, 2); Cell c_1_rand_5 = new Cell(1, 3, 2); Cell c_2_rand_5 = new Cell(2, 3, 2); Cell c_3_rand_5 = new Cell(2, 2, 2); stateBlockTetris = new Element_two_State__3(c_0_rand_5, c_1_rand_5, c_2_rand_5, c_3_rand_5); } if (RandNum == 6) { if ( CommonData.CommonArr[1, 3] > 0 && CommonData.CommonArr[1, 2] > 0 && CommonData.CommonArr[1, 1] > 0 && CommonData.CommonArr[0, 1] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_6 = new Cell(1, 3, 2); Cell c_1_rand_6 = new Cell(1, 2, 2); Cell c_2_rand_6 = new Cell(1, 1, 2); Cell c_3_rand_6 = new Cell(0, 1, 2); stateBlockTetris = new Element_two_State__4(c_0_rand_6, c_1_rand_6, c_2_rand_6, c_3_rand_6); } if (RandNum == 7) { if ( CommonData.CommonArr[1, 1] > 0 && CommonData.CommonArr[1, 2] > 0 && CommonData.CommonArr[1, 3] > 0 && CommonData.CommonArr[0, 2] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_7 = new Cell(1, 1, 3); Cell c_1_rand_7 = new Cell(1, 2, 3); Cell c_2_rand_7 = new Cell(1, 3, 3); Cell c_3_rand_7 = new Cell(0, 2, 3); stateBlockTetris = new Element_three_State__1(c_0_rand_7, c_1_rand_7, c_2_rand_7, c_3_rand_7); } if (RandNum == 8) { if ( CommonData.CommonArr[0, 1] > 0 && CommonData.CommonArr[1, 1] > 0 && CommonData.CommonArr[2, 1] > 0 && CommonData.CommonArr[1, 2] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_8 = new Cell(0, 1, 3); Cell c_1_rand_8 = new Cell(1, 1, 3); Cell c_2_rand_8 = new Cell(2, 1, 3); Cell c_3_rand_8 = new Cell(1, 2, 3); stateBlockTetris = new Element_three_State__2(c_0_rand_8, c_1_rand_8, c_2_rand_8, c_3_rand_8); } if (RandNum == 9) { if ( CommonData.CommonArr[0, 3] > 0 && CommonData.CommonArr[0, 2] > 0 && CommonData.CommonArr[0, 1] > 0 && CommonData.CommonArr[1, 2] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_9 = new Cell(0, 3, 3); Cell c_1_rand_9 = new Cell(0, 2, 3); Cell c_2_rand_9 = new Cell(0, 1, 3); Cell c_3_rand_9 = new Cell(1, 2, 3); stateBlockTetris = new Element_three_State__3(c_0_rand_9, c_1_rand_9, c_2_rand_9, c_3_rand_9); } if (RandNum == 10) { if ( CommonData.CommonArr[2, 2] > 0 && CommonData.CommonArr[1, 2] > 0 && CommonData.CommonArr[0, 2] > 0 && CommonData.CommonArr[1, 1] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_10 = new Cell(2, 2, 3); Cell c_1_rand_10 = new Cell(1, 2, 3); Cell c_2_rand_10 = new Cell(0, 2, 3); Cell c_3_rand_10 = new Cell(1, 1, 3); stateBlockTetris = new Element_three_State__4(c_0_rand_10, c_1_rand_10, c_2_rand_10, c_3_rand_10); } if (RandNum == 11) { if ( CommonData.CommonArr[2, 2] > 0 && CommonData.CommonArr[1, 2] > 0 && CommonData.CommonArr[0, 2] > 0 && CommonData.CommonArr[0, 1] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_11 = new Cell(2, 2, 4); Cell c_1_rand_11 = new Cell(1, 2, 4); Cell c_2_rand_11 = new Cell(0, 2, 4); Cell c_3_rand_11 = new Cell(0, 1, 4); stateBlockTetris = new Element_four_State__1(c_0_rand_11, c_1_rand_11, c_2_rand_11, c_3_rand_11); } if (RandNum == 12) { if ( CommonData.CommonArr[0, 3] > 0 && CommonData.CommonArr[0, 2] > 0 && CommonData.CommonArr[0, 1] > 0 && CommonData.CommonArr[1, 1] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_12 = new Cell(0, 3, 4); Cell c_1_rand_12 = new Cell(0, 2, 4); Cell c_2_rand_12 = new Cell(0, 1, 4); Cell c_3_rand_12 = new Cell(1, 1, 4); stateBlockTetris = new Element_four_State__2(c_0_rand_12, c_1_rand_12, c_2_rand_12, c_3_rand_12); } if (RandNum == 13) { if ( CommonData.CommonArr[0, 2] > 0 && CommonData.CommonArr[1, 2] > 0 && CommonData.CommonArr[2, 2] > 0 && CommonData.CommonArr[2, 3] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_13 = new Cell(0, 2, 4); Cell c_1_rand_13 = new Cell(1, 2, 4); Cell c_2_rand_13 = new Cell(2, 2, 4); Cell c_3_rand_13 = new Cell(2, 3, 4); stateBlockTetris = new Element_four_State__3(c_0_rand_13, c_1_rand_13, c_2_rand_13, c_3_rand_13); } if (RandNum == 14) { if ( CommonData.CommonArr[1, 1] > 0 && CommonData.CommonArr[1, 2] > 0 && CommonData.CommonArr[1, 3] > 0 && CommonData.CommonArr[0, 3] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_14 = new Cell(1, 1, 4); Cell c_1_rand_14 = new Cell(1, 2, 4); Cell c_2_rand_14 = new Cell(1, 3, 4); Cell c_3_rand_14 = new Cell(0, 3, 4); stateBlockTetris = new Element_four_State__4(c_0_rand_14, c_1_rand_14, c_2_rand_14, c_3_rand_14); } if (RandNum == 15) { if ( CommonData.CommonArr[0, 1] > 0 && CommonData.CommonArr[0, 2] > 0 && CommonData.CommonArr[1, 1] > 0 && CommonData.CommonArr[1, 2] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_15 = new Cell(0, 1, 1); Cell c_1_rand_15 = new Cell(0, 2, 1); Cell c_2_rand_15 = new Cell(1, 1, 1); Cell c_3_rand_15 = new Cell(1, 2, 1); stateBlockTetris = new Element_five(c_0_rand_15, c_1_rand_15, c_2_rand_15, c_3_rand_15); } if (RandNum == 16) { if ( CommonData.CommonArr[1, 3] > 0 && CommonData.CommonArr[1, 2] > 0 && CommonData.CommonArr[0, 2] > 0 && CommonData.CommonArr[0, 1] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_16 = new Cell(1, 3, 5); Cell c_1_rand_16 = new Cell(1, 2, 5); Cell c_2_rand_16 = new Cell(0, 2, 5); Cell c_3_rand_16 = new Cell(0, 1, 5); stateBlockTetris = new Element_six_State_1(c_0_rand_16, c_1_rand_16, c_2_rand_16, c_3_rand_16); } if (RandNum == 17) { if ( CommonData.CommonArr[0, 2] > 0 && CommonData.CommonArr[1, 2] > 0 && CommonData.CommonArr[1, 1] > 0 && CommonData.CommonArr[2, 1] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_17 = new Cell(0, 2, 5); Cell c_1_rand_17 = new Cell(1, 2, 5); Cell c_2_rand_17 = new Cell(1, 1, 5); Cell c_3_rand_17 = new Cell(2, 1, 5); stateBlockTetris = new Element_six_State_2(c_0_rand_17, c_1_rand_17, c_2_rand_17, c_3_rand_17); } if (RandNum == 18) { if ( CommonData.CommonArr[1, 1] > 0 && CommonData.CommonArr[1, 2] > 0 && CommonData.CommonArr[0, 2] > 0 && CommonData.CommonArr[0, 3] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_18 = new Cell(1, 1, 6); Cell c_1_rand_18 = new Cell(1, 2, 6); Cell c_2_rand_18 = new Cell(0, 2, 6); Cell c_3_rand_18 = new Cell(0, 3, 6); stateBlockTetris = new Element_seven_State_1(c_0_rand_18, c_1_rand_18, c_2_rand_18, c_3_rand_18); } if (RandNum == 19) { if ( CommonData.CommonArr[0, 2] > 0 && CommonData.CommonArr[1, 2] > 0 && CommonData.CommonArr[1, 3] > 0 && CommonData.CommonArr[2, 3] > 0) { CommonData.Logo_GameOver.SetActive(true); CommonData.Play = false; } Cell c_0_rand_19 = new Cell(0, 2, 6); Cell c_1_rand_19 = new Cell(1, 2, 6); Cell c_2_rand_19 = new Cell(1, 3, 6); Cell c_3_rand_19 = new Cell(2, 3, 6); stateBlockTetris = new Element_seven_State_2(c_0_rand_19, c_1_rand_19, c_2_rand_19, c_3_rand_19); } return(stateBlockTetris); }