// Complete void MoveActiveBlocks_Down(Vector2 v2_BottomLeft, Enum_BlockSize BlockSize_) { #region Ensure appropriate spaces below are empty. Otherwise, convert all blocks to static. if (v2_BottomLeft.y - 1 < 0) { AllBlocksStatic(); return; } if (GetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y - 1) != Enum_BlockType.Empty) { AllBlocksStatic(); return; } if (GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y - 1) != Enum_BlockType.Empty) { AllBlocksStatic(); return; } if (BlockSize_ == Enum_BlockSize.size_3w_2h || BlockSize_ == Enum_BlockSize.size_3w_3h) { if (GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y - 1) != Enum_BlockType.Empty) { AllBlocksStatic(); return; } } #endregion GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().Set_ClearBackdrops(); #region Default 2x2 // (0,0) -> (0, -1) SetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y - 1, GetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y)); // (1, 0) -> (0, -1) SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y - 1, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y)); // (0, 1) -> (0, 0) SetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y, GetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y + 1)); // (1,1) -> (1, 0) SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1)); if(BlockSize_ == Enum_BlockSize.size_2w_2h) { // (0,1) -> CLEAR SetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y + 1, Enum_BlockType.Empty); // (1,1) -> CLEAR SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1, Enum_BlockType.Empty); } #endregion #region 3 wide by 2 tall if(BlockSize_ == Enum_BlockSize.size_3w_2h || BlockSize_ == Enum_BlockSize.size_3w_3h) { // (2, 0) -> (2, -1) SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y - 1, GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y)); // (2, 1) -> (2, 0) SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y , GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 1)); // If 3x2: if (BlockSize_ == Enum_BlockSize.size_3w_2h) { // (0,1) -> CLEAR SetBlock((int)v2_BottomLeft.x , (int)v2_BottomLeft.y + 1, Enum_BlockType.Empty); // (1,1) -> CLEAR SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1, Enum_BlockType.Empty); // (2,1) -> CLEAR SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 1, Enum_BlockType.Empty); } } #endregion #region 2 wide by 3 tall if (BlockSize_ == Enum_BlockSize.size_2w_3h || BlockSize_ == Enum_BlockSize.size_3w_3h) { // (0,2) -> (0, 1) SetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y + 2)); // (1,2) -> (1, 1) SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 2)); // (0,2) -> CLEAR SetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y + 2, Enum_BlockType.Empty); // (1,2) -> CLEAR SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 2, Enum_BlockType.Empty); } #endregion #region 3 wide by 3 tall if (BlockSize_ == Enum_BlockSize.size_3w_3h) { // (2,2) -> (2,1) SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 2)); // (2,2) -> CLEAR SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 2, Enum_BlockType.Empty); } #endregion #region Send movement to BoardDisplay GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().ShiftBlocks(Enum_Direction.Down, e_BlockSize, v2_BottomLeft); #endregion // Move the CurrentBlockLocation 'y' --v2_ActiveBlockLocation.y; // Show new block drop positions PotentialBlockVisual(); }
// Complete void MoveActiveBlocks_Left(Vector2 v2_BottomLeft, Enum_BlockSize e_BlockSize_) { #region Ensure appropriate spaces below are empty. Otherwise, do not do anything. if (v2_BottomLeft.x - 1 < 0) { return; } // As for block repositioning, I do not want blocks to be pushed around if another block exists. if (GetBlock((int)v2_BottomLeft.x - 1, (int)v2_BottomLeft.y + 0) != Enum_BlockType.Empty) { return; } if (GetBlock((int)v2_BottomLeft.x - 1, (int)v2_BottomLeft.y + 1) != Enum_BlockType.Empty) { return; } // Check in case the active blocks we have are 3 high if(e_BlockSize_ == Enum_BlockSize.size_2w_3h || e_BlockSize_ == Enum_BlockSize.size_3w_3h) { if (GetBlock((int)v2_BottomLeft.x - 1, (int)v2_BottomLeft.y + 2) != Enum_BlockType.Empty) { return; } } #endregion GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().Set_ClearBackdrops(); #region Default 2x2 // (0,0) -> (-1, 0) SetBlock((int)v2_BottomLeft.x - 1, (int)v2_BottomLeft.y + 0, GetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y)); // (1, 0) -> (0, 0) SetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 0, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y)); // (0, 1) -> (-1, 1) SetBlock((int)v2_BottomLeft.x - 1, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y + 1)); // (1, 1) -> (0, 1) SetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1)); if (e_BlockSize_ == Enum_BlockSize.size_2w_2h) { // (1,0) -> CLEAR SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y, Enum_BlockType.Empty); // (1,1) -> CLEAR SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1, Enum_BlockType.Empty); } #endregion #region 3 wide by 2 tall if (e_BlockSize_ == Enum_BlockSize.size_3w_2h || e_BlockSize_ == Enum_BlockSize.size_3w_3h) { // (2, 0) -> (1, 0) SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y, GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y)); // (2, 1) -> (1, 1) SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 1)); // (2,0) -> CLEAR SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y, Enum_BlockType.Empty); // (2,1) -> CLEAR SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 1, Enum_BlockType.Empty); } #endregion #region 2 wide by 3 tall if (e_BlockSize_ == Enum_BlockSize.size_2w_3h || e_BlockSize_ == Enum_BlockSize.size_3w_3h) { // (0,2) -> (-1, 2) SetBlock((int)v2_BottomLeft.x - 1, (int)v2_BottomLeft.y + 2, GetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y + 2)); // (1,2) -> (0, 2) SetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y + 2, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 2)); // If 2x3: if(e_BlockSize_ == Enum_BlockSize.size_2w_3h) { // (1,0) -> CLEAR SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y, Enum_BlockType.Empty); // (1,1) -> CLEAR SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1, Enum_BlockType.Empty); // (1,2) -> CLEAR SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 2, Enum_BlockType.Empty); } } #endregion #region 3 wide by 3 tall if (e_BlockSize_ == Enum_BlockSize.size_3w_3h) { // (2,2) -> (1,2) SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 2, GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 2)); // (2,2) -> CLEAR SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 2, Enum_BlockType.Empty); } #endregion #region Send movement to BoardDisplay GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().ShiftBlocks(Enum_Direction.Left, e_BlockSize, v2_BottomLeft); #endregion --v2_ActiveBlockLocation.x; // Show new block drop positions PotentialBlockVisual(); }
// Use this for initialization void Start() { // Initialization go_FadeOut = GameObject.Find("FadeOut"); go_SFX = GameObject.Find("AudioSource_SFX"); sfx_ScoreEffect = Resources.Load("SFX_Score") as AudioClip; Enum_BlockSize e_MaxBlockSize = Enum_BlockSize.size_2w_2h; if( b_3w_3h_Allowed || (b_2w_3h_Allowed && b_3w_2h_Allowed) ) { e_MaxBlockSize = Enum_BlockSize.size_3w_3h; } else { if(b_3w_2h_Allowed) { e_MaxBlockSize = Enum_BlockSize.size_3w_2h; } else if(b_2w_3h_Allowed) { e_MaxBlockSize = Enum_BlockSize.size_2w_3h; } } // Initialize Board GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().Init_Board( i_ArrayWidth, i_ArrayHeight, 0, e_MaxBlockSize ); // Set i_TimeToDrop_Max to be -1 if it starts at 0, to make sure we aren't dropping infinitely if (i_TimeToDrop_Max == 0) i_TimeToDrop_Max = -1; #region Set First Block to Random Size // Determine the size of the next block to use bool b_FoundNextBlock = false; // While we haven't found the next block, loop while (!b_FoundNextBlock) { int i_RandBlock = Random.Range(0, 4); if (i_RandBlock == 0 && b_2w_2h_Allowed) { e_NextBlockSize = Enum_BlockSize.size_2w_2h; b_FoundNextBlock = true; } else if (i_RandBlock == 1 && b_2w_3h_Allowed) { e_NextBlockSize = Enum_BlockSize.size_2w_3h; b_FoundNextBlock = true; } else if (i_RandBlock == 2 && b_3w_2h_Allowed) { e_NextBlockSize = Enum_BlockSize.size_3w_2h; b_FoundNextBlock = true; } else if (i_RandBlock == 3 && b_3w_3h_Allowed) { e_NextBlockSize = Enum_BlockSize.size_3w_3h; b_FoundNextBlock = true; } } // Set random initial block e_BlockSize = e_NextBlockSize; #endregion // Initialize NextBlockList for(int i_ = 0; i_ < e_NextBlockList.Length; ++i_) { e_NextBlockList[i_] = Enum_BlockType.Empty; } PopulateNextBlockList(); // Initialize block array BlockArray = new Enum_BlockType[i_ArrayHeight, i_ArrayWidth]; Initialize_BlockArray(); // PrintArrayToConsole(); }
void AllBlocksStatic() { b_RunAgain = false; #region Set Left & Right Walls to 'Empty' (Done BEFORE scoring) for (int y_ = 0; y_ < i_ArrayHeight; ++y_) { // Tell the board model to destroy the block if (GetBlock(0, y_) != Enum_BlockType.Empty) { GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().DestroyBlockAt(new IntVector2(0, y_)); } // Set Left Wall to be 'Empty' SetBlock(0, y_, Enum_BlockType.Empty); // Tell the board model to destroy the block if (GetBlock(i_ArrayWidth - 1, y_) != Enum_BlockType.Empty) { GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().DestroyBlockAt(new IntVector2(i_ArrayWidth - 1, y_)); } // Set Right Wall to be 'Empty' SetBlock(i_ArrayWidth - 1, y_, Enum_BlockType.Empty); } #endregion #region Convert All to Static // Run through the array and convert all blocks into their static counterpart. Run bottom to top, left to right. for (int x_ = 0; x_ < i_ArrayWidth; ++x_) { for (int y_ = 0; y_ < i_ArrayHeight; ++y_) { Enum_BlockType tempBlock = GetBlock(x_, y_); if (tempBlock == Enum_BlockType.Block_1_Active) { SetBlock(x_, y_, Enum_BlockType.Block_1_Static); } else if (tempBlock == Enum_BlockType.Block_2_Active) { SetBlock(x_, y_, Enum_BlockType.Block_2_Static); } else if (tempBlock == Enum_BlockType.Block_3_Active) { SetBlock(x_, y_, Enum_BlockType.Block_3_Static); } } } #endregion #region Pull Blocks Down PullBlocksDown(); #endregion // TODO: RUN SCORE CODE HERE FIRST if (Load_ScoreLine()) { #region Print Scoreline to console string s_ScoreLine = "LINE REACHED: (" + iv2_ScoreLine.Count + "):"; for (int i_ = 0; i_ < iv2_ScoreLine.Count; ++i_) { if (i_ != iv2_ScoreLine.Count - 1) { s_ScoreLine += iv2_ScoreLine[i_] + ", "; } else { s_ScoreLine += iv2_ScoreLine[i_] + ""; } } print(s_ScoreLine); #endregion CheckScoreLineLeftWall(); // Destroy all Black Blocks if (b_ThreeBlockColors) { DestroyBlackBlocks(); } b_RunAgain = true; e_PauseEffect = Enum_PauseEffect.ScoreLine; GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().Set_ScoreTextIncrease(iv2_ScoreLine.Count); i_ScoreLine_Counter = 0; return; } #region Set 'Mid Empty' row to empty (Done AFTER scoring) //for (int y_ = 0; y_ < i_ArrayHeight; ++y_) //{ // if (b_MidRowBlank) // { // if (i_ExtraBlankRow > 0 && // i_ExtraBlankRow < i_ArrayWidth) // { // // Destroy the block model on screen // if (GetBlock(0, y_) != Enum_BlockType.Empty) // { // GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().DestroyBlockAt(new IntVector2(i_ExtraBlankRow, y_)); // } // SetBlock(i_ExtraBlankRow, y_, Enum_BlockType.Empty); // } // } //} #endregion // Set the next block size to be whatever we found e_BlockSize = e_NextBlockSize; // Clear all backdrops now. Creating new blocks will reset the new backdrop colors // GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().Set_ClearBackdrops(); if(b_RunAgain) { AllBlocksStatic(); // GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().Set_ClearBackdrops(); } else { // GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().Set_ClearBackdrops(); Load_ScoreLine(); CheckScoreLineLeftWall(); CreateNewBlock(); // Reset time for new block to be created f_TimeToDrop = -1f; } }
// Fills e_NextBlockList with random blocks to push into CreateNewBlock void PopulateNextBlockList() { // Find the first unpopulated position int i_FirstOpenPosition = 0; for(int j_ = 0; j_ < e_NextBlockList.Length; ++j_) { if (e_NextBlockList[j_] == Enum_BlockType.Empty) continue; else i_FirstOpenPosition = j_; } // Changing the system. 0/1/2 = Block 1, 3/4/5 = Block 2, 6 = Block 3. // If 'b_ThreeBlockColors', a 1-in-7 chance to have a black block int i_NumBlockTypes = 2; if(b_ThreeBlockColors) { if(e_WhiteBlockChance == Enum_WhiteBlockChance.OneInThree) i_NumBlockTypes = 3; else if (e_WhiteBlockChance == Enum_WhiteBlockChance.OneInFive) i_NumBlockTypes = 5; else if (e_WhiteBlockChance == Enum_WhiteBlockChance.OneInSeven) i_NumBlockTypes = 7; else if (e_WhiteBlockChance == Enum_WhiteBlockChance.OneInNine) i_NumBlockTypes = 9; else if (e_WhiteBlockChance == Enum_WhiteBlockChance.OneInEleven) i_NumBlockTypes = 11; } // Start from the first open position & populate all remaining positions for(int i_ = i_FirstOpenPosition; i_ < e_NextBlockList.Length; ++i_) { // Find a random block int i_RandBlock = Random.Range(0, i_NumBlockTypes); // Block 'One' if( i_RandBlock < i_NumBlockTypes / 2 ) { e_NextBlockList[i_] = Enum_BlockType.Block_1_Active; } // Block 'Two' else if( i_RandBlock >= i_NumBlockTypes / 2 && i_RandBlock != i_NumBlockTypes - 1 ) { e_NextBlockList[i_] = Enum_BlockType.Block_2_Active; } // Block 'Three' else { if(b_ThreeBlockColors) { e_NextBlockList[i_] = Enum_BlockType.Block_3_Active; } // Special probability case since we need to hit a 0 or 1 if we're not checking for three block types else { e_NextBlockList[i_] = Enum_BlockType.Block_2_Active; } } } // Determine the size of the next block to use bool b_FoundNextBlock = false; // While we haven't found the next block, loop while(!b_FoundNextBlock) { int i_RandBlock = Random.Range(0, 4); if(i_RandBlock == 0 && b_2w_2h_Allowed) { e_NextBlockSize = Enum_BlockSize.size_2w_2h; b_FoundNextBlock = true; } else if (i_RandBlock == 1 && b_2w_3h_Allowed) { e_NextBlockSize = Enum_BlockSize.size_2w_3h; b_FoundNextBlock = true; } else if (i_RandBlock == 2 && b_3w_2h_Allowed) { e_NextBlockSize = Enum_BlockSize.size_3w_2h; b_FoundNextBlock = true; } else if (i_RandBlock == 3 && b_3w_3h_Allowed) { e_NextBlockSize = Enum_BlockSize.size_3w_3h; b_FoundNextBlock = true; } } }
// Complete void RotateBlocks_CounterClock(Vector2 v2_BottomLeft, Enum_BlockSize BlockSize_) { GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().Set_ClearBackdrops(); // Store Bottom Left (Temporary) Enum_BlockType e_TempBlockType_ = GetBlock((int)v2_BottomLeft.x, (int)v2_BottomLeft.y); // Bottom Left -> Top Left SetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 0, GetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 1)); if (BlockSize_ == Enum_BlockSize.size_2w_2h) { // Top Left -> Top Right SetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1)); // Top Right -> Bottom Right SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 0)); } else if (BlockSize_ == Enum_BlockSize.size_3w_2h) { // (0,1) becomes (1,1) SetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1)); // (1,1) becomes (2,1) SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 1)); // (2,1) becomes (2,0) SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 0)); // (2,0) becomes (1,0) SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 0, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 0)); } else if (BlockSize_ == Enum_BlockSize.size_2w_3h) { // (0,1) becomes (0,2) SetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 2)); // (0,2) becomes (1,2) SetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 2, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 2)); // (1,2) becomes (1,1) SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 2, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1)); // (1,1) becomes (1,0) SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 0)); } else if (BlockSize_ == Enum_BlockSize.size_3w_3h) { // (0,1) becomes (0,2) SetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 2)); // (0,2) becomes (1,2) SetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 2, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 2)); // (1,2) becomes (2,2) SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 2, GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 2)); // (2,2) becomes (2,1) SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 2, GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 1)); // (2,1) becomes (2,0) SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 0)); // (2,0) becomes (1,0) SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 0, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 0)); } // (1,0) becomes Temporary SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 0, e_TempBlockType_); GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().RotateBlocks( Enum_Direction.Left, e_BlockSize, v2_BottomLeft ); // Show new block drop positions PotentialBlockVisual(); }
public void Set_NextBlockArray( Enum_BlockType[,] e_BlockType_, Enum_BlockSize e_BlockSize_, IntVector2 iv2_BottomLeft_ ) { if(e_BlockSize_ == Enum_BlockSize.size_2w_2h) { } //float f_LeftColumn = f_BlockScale_ + f_Buffer_; //float f_CenterColumn = f_LeftColumn + f_BlockScale_ + f_Buffer_; //float f_RightColumn = f_CenterColumn + f_BlockScale_ + f_Buffer_; //float f_MiddleRow = Screen.height / 2f; //float f_TopRow = f_MiddleRow + f_BlockScale_ + f_Buffer_; //float f_BottomRow = f_MiddleRow - f_BlockScale_ - f_Buffer_; /* // Find Height/Width of block array int i_BlockWidth = 2; int i_BlockHeight = 2; // 3 Wide if (e_BlockSize_ == Enum_BlockSize.size_3w_2h || e_BlockSize_ == Enum_BlockSize.size_3w_3h) i_BlockWidth = 3; // 3 High if (e_BlockSize_ == Enum_BlockSize.size_2w_3h || e_BlockSize_ == Enum_BlockSize.size_3w_3h) i_BlockHeight = 3; // Run through the list of NewBlockTypeArray for (int y_ = 0; y_ < i_BlockHeight; ++y_) { for (int x_ = 0; x_ < i_BlockWidth; ++x_) { GameObject go_BlockTemp; // Create a new block based on the position within NewBlockTypeArray if (e_BlockType_[y_, x_] == Enum_BlockType.Block_1_Active) { // go_BlockTemp is Instantiated as above by default go_BlockTemp = Instantiate(go_Block_A); go_BlockTemp.transform.SetParent(GameObject.Find("DisplayBlockList").transform); } else if (e_BlockType_[y_, x_] == Enum_BlockType.Block_2_Active) { go_BlockTemp = Instantiate(go_Block_B); go_BlockTemp.transform.SetParent(GameObject.Find("DisplayBlockList").transform); } else if (e_BlockType_[y_, x_] == Enum_BlockType.Block_3_Active) { go_BlockTemp = Instantiate(go_Block_C); go_BlockTemp.transform.SetParent(GameObject.Find("DisplayBlockList").transform); } else { print("INVALID BLOCK ADDED TO CS_BOARDDISPLAY"); go_BlockTemp = Instantiate(go_Empty); go_BlockTemp.transform.SetParent(GameObject.Find("EmptyBlocks").transform); } // Initialize this block int i_NewX = x_ + iv2_BottomLeft_.x; int i_NewY = y_ + iv2_BottomLeft_.y; if (go_BlockTemp.GetComponent<Cs_BlockOnBoardLogic>()) { go_BlockTemp.GetComponent<Cs_BlockOnBoardLogic>().Init_BlockModel(i_NewX, i_NewY, 3.0f, 0.75f, i_Width); } // Set the Backdrop Color // Set_BackdropColor(e_NewBlockTypeArray_[y_, x_], new IntVector2(i_NewX, i_NewY)); // Add this block type to the proper position within Display Array DisplayArray[i_NewY, i_NewX] = e_NewBlockTypeArray_[y_, x_]; DisplayArray_Blocks[i_NewY, i_NewX] = go_BlockTemp; } } */ }
// TODO: Fix & Complete void MoveActiveBlocks_Right(Vector2 v2_BottomLeft, Enum_BlockSize BlockSize_) { // Check two spaces over from the bottom left block // Return check. Performs no operation if we're outside the size of the grid if (BlockSize_ == Enum_BlockSize.size_2w_2h || BlockSize_ == Enum_BlockSize.size_2w_3h) { // If the position to the right of the block doesn't exist, quit out. if (v2_BottomLeft.x + 2 >= i_ArrayWidth) { return; } // if (v2_BottomLeft.x + 2 > ) { return; } // If the position to the right of the block isn't empty, quit out if (GetBlock( (int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y ) != Enum_BlockType.Empty) { return; } if (GetBlock( (int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 1) != Enum_BlockType.Empty) { return; } } else // Block is 3 wide, not 2 { // If the position to the right of the block doesn't exist, quit out. if (v2_BottomLeft.x + 3 >= i_ArrayWidth) { return; } // If the position to the right of the block isn't empty, quit out if (GetBlock((int)v2_BottomLeft.x + 3, (int)v2_BottomLeft.y) != Enum_BlockType.Empty) { return; } if (GetBlock((int)v2_BottomLeft.x + 3, (int)v2_BottomLeft.y + 1) != Enum_BlockType.Empty) { return; } } GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().Set_ClearBackdrops(); #region Run the check from the top right, backward if (BlockSize_ == Enum_BlockSize.size_3w_3h) { // 2, 2 -> 3, 2 SetBlock((int)v2_BottomLeft.x + 3, (int)v2_BottomLeft.y + 2, GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 2)); } if(BlockSize_ == Enum_BlockSize.size_2w_3h || BlockSize_ == Enum_BlockSize.size_3w_3h) { // 1, 2 -> 2, 2 SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 2, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 2)); // 0, 2 -> 1, 2 SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 2, GetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 2)); // 0, 2 -> CLEAR SetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 2, Enum_BlockType.Empty); } if (BlockSize_ == Enum_BlockSize.size_3w_2h || BlockSize_ == Enum_BlockSize.size_3w_3h) { // 2, 1 -> 3, 1 SetBlock((int)v2_BottomLeft.x + 3, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 1)); // 2, 0 -> 3, 0 SetBlock((int)v2_BottomLeft.x + 3, (int)v2_BottomLeft.y + 0, GetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 0)); } // Default (2x2 Block) - Remember, reverse order. Right to Left. // 1, 1 -> 2, 1 SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1)); // 0, 1 -> 1, 1 SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 1, GetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 1)); // 0, 1 -> CLEAR SetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 1, Enum_BlockType.Empty); // 1, 0 -> 2, 0 SetBlock((int)v2_BottomLeft.x + 2, (int)v2_BottomLeft.y + 0, GetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 0)); // 0, 0 -> 1, 0 SetBlock((int)v2_BottomLeft.x + 1, (int)v2_BottomLeft.y + 0, GetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 0)); // 0, 0 -> CLEAR SetBlock((int)v2_BottomLeft.x + 0, (int)v2_BottomLeft.y + 0, Enum_BlockType.Empty); #endregion #region Send movement to BoardDisplay GameObject.Find("BoardDisplay").GetComponent<Cs_BoardDisplay>().ShiftBlocks(Enum_Direction.Right, e_BlockSize, v2_BottomLeft); #endregion ++v2_ActiveBlockLocation.x; // Show new block drop positions PotentialBlockVisual(); }
public void ShiftBlocks( Enum_Direction e_MoveDir_, Enum_BlockSize e_BlockSize_, Vector2 v2_BottomLeft_ ) { IntVector2 iv2_BottomLeft = new IntVector2( (int)v2_BottomLeft_.x, (int)v2_BottomLeft_.y ); ShiftBlocks(e_MoveDir_, e_BlockSize_, iv2_BottomLeft); }
public void ShiftBlocks( Enum_Direction e_MoveDir_, Enum_BlockSize e_BlockSize_, IntVector2 iv2_BottomLeft_) { if( e_MoveDir_ == Enum_Direction.Left ) { #region Shift Left // Shift original 2x2 left MoveBlock_Dir(Enum_Direction.Left, iv2_BottomLeft_); MoveBlock_Dir(Enum_Direction.Left, new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 0)); MoveBlock_Dir(Enum_Direction.Left, new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 1)); MoveBlock_Dir(Enum_Direction.Left, new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 1)); // 3 wide if(e_BlockSize_ == Enum_BlockSize.size_3w_2h || e_BlockSize_ == Enum_BlockSize.size_3w_3h) { MoveBlock_Dir(Enum_Direction.Left, new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 0)); MoveBlock_Dir(Enum_Direction.Left, new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 1)); } // 3 high if (e_BlockSize_ == Enum_BlockSize.size_2w_3h || e_BlockSize_ == Enum_BlockSize.size_3w_3h) { MoveBlock_Dir(Enum_Direction.Left, new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 2)); MoveBlock_Dir(Enum_Direction.Left, new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 2)); } // 3x3 if(e_BlockSize_ == Enum_BlockSize.size_3w_3h) { MoveBlock_Dir(Enum_Direction.Left, new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 2)); } #endregion } else if( e_MoveDir_ == Enum_Direction.Right ) { #region Shift Right // Order is jumbled to allow blocks to not overwrite one-another // 3x3 if (e_BlockSize_ == Enum_BlockSize.size_3w_3h) { MoveBlock_Dir(Enum_Direction.Right, new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 2)); } // 3 wide if (e_BlockSize_ == Enum_BlockSize.size_3w_2h || e_BlockSize_ == Enum_BlockSize.size_3w_3h) { MoveBlock_Dir(Enum_Direction.Right, new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 0)); MoveBlock_Dir(Enum_Direction.Right, new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 1)); } // 3 high if (e_BlockSize_ == Enum_BlockSize.size_2w_3h || e_BlockSize_ == Enum_BlockSize.size_3w_3h) { MoveBlock_Dir(Enum_Direction.Right, new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 2)); MoveBlock_Dir(Enum_Direction.Right, new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 2)); } // Shift original 2x2 left MoveBlock_Dir(Enum_Direction.Right, new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 0)); MoveBlock_Dir(Enum_Direction.Right, new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 1)); MoveBlock_Dir(Enum_Direction.Right, iv2_BottomLeft_); MoveBlock_Dir(Enum_Direction.Right, new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 1)); #endregion } else if( e_MoveDir_ == Enum_Direction.Down ) { #region Shift Down // Shift original 2x2 left MoveBlock_Dir(Enum_Direction.Down, iv2_BottomLeft_); MoveBlock_Dir(Enum_Direction.Down, new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 0)); MoveBlock_Dir(Enum_Direction.Down, new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 1)); MoveBlock_Dir(Enum_Direction.Down, new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 1)); // 3 wide if (e_BlockSize_ == Enum_BlockSize.size_3w_2h || e_BlockSize_ == Enum_BlockSize.size_3w_3h) { MoveBlock_Dir(Enum_Direction.Down, new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 0)); MoveBlock_Dir(Enum_Direction.Down, new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 1)); } // 3 high if (e_BlockSize_ == Enum_BlockSize.size_2w_3h || e_BlockSize_ == Enum_BlockSize.size_3w_3h) { MoveBlock_Dir(Enum_Direction.Down, new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 2)); MoveBlock_Dir(Enum_Direction.Down, new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 2)); } // 3x3 if (e_BlockSize_ == Enum_BlockSize.size_3w_3h) { MoveBlock_Dir(Enum_Direction.Down, new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 2)); } #endregion } // Play Sound Effect go_ThemeManager.GetComponent<Cs_AudioManager>().Play_SoundEffect(Enum_SoundEffect.Move); }
// When called from BoardLogic, create the grid background public void Init_Board(int i_Width_, int i_Height_, int i_MidWall_ = -1, Enum_BlockSize e_BlockSize_ = Enum_BlockSize.size_2w_2h) { i_Height = i_Height_; i_Width = i_Width_; LoadResources(); #region Create Grid & GridWalls if (i_MidWall_ > 1 && i_MidWall_ < i_Width_ - 2) { } else // No midwall { for (int y_ = 0; y_ < i_Height; ++y_) { GameObject go_WallTemp; Grid_Row = new List<GameObject>(); for (int x_ = 0; x_ < i_Width_; ++x_) { // Instantiate the object go_WallTemp = Instantiate(go_GridBlock); // Add a GridWall if (x_ == 0 || x_ == i_Width_ - 1) { // Instantiate the object GameObject.Destroy(go_WallTemp); // Destroys the previous block that was created go_WallTemp = Instantiate(go_GridWall); } else { #region 2 Wide // Check for initial block positions if(e_BlockSize_ == Enum_BlockSize.size_2w_2h || e_BlockSize_ == Enum_BlockSize.size_2w_3h) { // Left side int i_xPos = (i_Width - 1) / 2; if (x_ == i_xPos || x_ == i_xPos + 1) { if(e_BlockSize_ == Enum_BlockSize.size_2w_2h) { if( y_ >= i_Height - 2) { go_WallTemp = Instantiate(go_GridWarning); } } else // 2x3 { if( y_ >= i_Height - 3) { go_WallTemp = Instantiate(go_GridWarning); } } } } #endregion else if(e_BlockSize_ == Enum_BlockSize.size_3w_2h || e_BlockSize_ == Enum_BlockSize.size_3w_3h) { // Left side int i_xPos = ((i_Width - 1) / 2) - 1; if (x_ == i_xPos || x_ == i_xPos + 1 || x_ == i_xPos + 2 ) { if (e_BlockSize_ == Enum_BlockSize.size_3w_2h) { if (y_ >= i_Height - 2) { GameObject.Destroy(go_WallTemp); // Destroys the previous block that was created go_WallTemp = Instantiate(go_GridWarning); } } else // 2x3 { if (y_ >= i_Height - 3) { GameObject.Destroy(go_WallTemp); // Destroys the previous block that was created go_WallTemp = Instantiate(go_GridWarning); } } } } } Grid_Row.Add(go_WallTemp); // Set position go_WallTemp.transform.position = new Vector3(x_ * go_GridBlock.transform.lossyScale.x, y_ * go_GridBlock.transform.lossyScale.y, 0); go_WallTemp.transform.parent = GameObject.Find("GridBlockList").transform; } // Add the current Row to the Column List Grid_Columns.Add(Grid_Row); } // Reset the Row Grid_Row = new List<GameObject>(); // Set the position } #endregion #region Populate 'Block Array' & 'Display Array' as empty DisplayArray = new Enum_BlockType[i_Height, i_Width]; DisplayArray_Blocks = new GameObject[i_Height, i_Width]; for (int y_ = 0; y_ < i_Height; ++y_) { for (int x_ = 0; x_ < i_Width; ++x_) { DisplayArray[y_, x_] = Enum_BlockType.Empty; DisplayArray_Blocks[y_, x_] = Instantiate(go_Empty); // Set parent (for Editor clutter) DisplayArray_Blocks[y_, x_].transform.SetParent(GameObject.Find("EmptyBlocks").transform); } } #endregion // Set camera position go_Camera.GetComponent<Cs_CameraController>().Init_CameraPosition(i_Width_, i_Height_, 3.0f); }
public void RotateBlocks(Enum_Direction e_RotDir_, Enum_BlockSize e_BlockSize_, Vector2 v2_BottomLeft_) { IntVector2 iv2_Temp = new IntVector2((int)v2_BottomLeft_.x, (int)v2_BottomLeft_.y); RotateBlocks(e_RotDir_, e_BlockSize_, iv2_Temp); }
public void RotateBlocks(Enum_Direction e_RotDir_, Enum_BlockSize e_BlockSize_, IntVector2 iv2_BottomLeft_) { // Store Bottom Left Enum_BlockType e_BotLeftBlock = DisplayArray[iv2_BottomLeft_.y, iv2_BottomLeft_.x]; GameObject go_BotLeftBlock = DisplayArray_Blocks[iv2_BottomLeft_.y, iv2_BottomLeft_.x]; // Only continue if a block exists if(DisplayArray[iv2_BottomLeft_.y, iv2_BottomLeft_.x] == Enum_BlockType.Empty) return; if (e_RotDir_ == Enum_Direction.Left) { #region Shift Left (Counter-clockwise) if( e_BlockSize_ == Enum_BlockSize.size_2w_2h) { // Move Blocks Visually DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveDown(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveLeft(); DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveUp(); DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveRight(); // Re-arrange the blocks in the DisplayArray_Blocks to match DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1] = DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = go_BotLeftBlock; // Re-arrange the blocks in the Display Array to match DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1] = DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = e_BotLeftBlock; // Change the Grid_Backdrop Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 0)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 0)); } else if( e_BlockSize_ == Enum_BlockSize.size_3w_2h ) { // Move Blocks Visually DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveRight(); DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveRight(); DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveUp(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveLeft(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveLeft(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveDown(); // Re-arrange the blocks in the DisplayArray_Blocks to match DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2] = DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2]; DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2] = DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = go_BotLeftBlock; // Re-arrange the blocks in the Display Array to match DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2] = DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2]; DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2] = DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = e_BotLeftBlock; // Change the Grid_Backdrop Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 0)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2], new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2], new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 0)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 0)); } else if( e_BlockSize_ == Enum_BlockSize.size_2w_3h ) { // Move Blocks Visually DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveRight(); DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveUp(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveUp(); DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveLeft(); DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveDown(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveDown(); // Re-arrange the blocks in the DisplayArray_Blocks to match DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0]; DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1] = DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = go_BotLeftBlock; // Re-arrange the blocks in the Display Array to match DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0]; DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1] = DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = e_BotLeftBlock; // Change the Grid_Backdrop Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 0)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 2)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 2)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 0)); } else if( e_BlockSize_ == Enum_BlockSize.size_3w_3h ) { // Move Blocks Visually DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveRight(); DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveRight(); DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveUp(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveUp(); DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 2].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveLeft(); DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveLeft(); DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveDown(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveDown(); // Re-arrange the blocks in the DisplayArray_Blocks to match DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0]; DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1] = DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 2]; DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 2] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2] = DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2]; DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2] = DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = go_BotLeftBlock; // Re-arrange the blocks in the Display Array to match DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0]; DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1] = DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 2]; DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 2] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2] = DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2]; DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2] = DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = e_BotLeftBlock; // Change the Grid_Backdrop Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 0)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 2)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 2)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 2], new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 2)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2], new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2], new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 0)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 0)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 1)); } // Play Sound Effect go_ThemeManager.GetComponent<Cs_AudioManager>().Play_SoundEffect(Enum_SoundEffect.RotateCounterclock); #endregion } else if( e_RotDir_ == Enum_Direction.Right ) { #region Shift Right (Clockwise) if( e_BlockSize_ == Enum_BlockSize.size_2w_2h) { // Move Blocks Visually DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveUp(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveRight(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveDown(); DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveLeft(); // Re-arrange the blocks in the DisplayArray_Blocks to match DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = go_BotLeftBlock; // Re-arrange the blocks in the Display Array to match DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = e_BotLeftBlock; // Change the Grid_Backdrop Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 0)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 0)); } else if( e_BlockSize_ == Enum_BlockSize.size_3w_2h ) { // Move Blocks Visually DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveUp(); DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveLeft(); DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveLeft(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveDown(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveRight(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveRight(); // Re-arrange the blocks in the DisplayArray_Blocks to match DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2]; DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = go_BotLeftBlock; // Re-arrange the blocks in the Display Array to match DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2]; DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = e_BotLeftBlock; // Change the Grid_Backdrop Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 0)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2], new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2], new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 0)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 0)); } else if( e_BlockSize_ == Enum_BlockSize.size_2w_3h ) { // Move Blocks Visually (Clockwise) DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveUp(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveUp(); DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveRight(); DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveDown(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveDown(); DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveLeft(); // Re-arrange the blocks in the DisplayArray_Blocks to match DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1] = DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1] = DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0]; DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = go_BotLeftBlock; // Re-arrange the blocks in the Display Array to match DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1] = DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1] = DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0]; DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = e_BotLeftBlock; // Change the Grid_Backdrop Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 0)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 2)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 2)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 0)); } else if( e_BlockSize_ == Enum_BlockSize.size_3w_3h ) { // Move Blocks Visually (Clockwise) DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveUp(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveUp(); DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveRight(); DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveRight(); DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 2].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveDown(); DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveDown(); DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveLeft(); DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveLeft(); // Re-arrange the blocks in the DisplayArray_Blocks to match DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2]; DisplayArray_Blocks[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2] = DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 2]; DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 2] = DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1]; DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1] = DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0]; DisplayArray_Blocks[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0] = DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray_Blocks[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = go_BotLeftBlock; // Re-arrange the blocks in the Display Array to match DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1] = DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2]; DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2] = DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 2]; DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 2] = DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1]; DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1] = DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0]; DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0] = DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0]; DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0] = e_BotLeftBlock; // Change the Grid_Backdrop Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 0)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 0], new IntVector2(iv2_BottomLeft_.x + 0, iv2_BottomLeft_.y + 2)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 2)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 2, iv2_BottomLeft_.x + 2], new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 2)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 2], new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 1)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 2], new IntVector2(iv2_BottomLeft_.x + 2, iv2_BottomLeft_.y + 0)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 0, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 0)); Set_BackdropColor(DisplayArray[iv2_BottomLeft_.y + 1, iv2_BottomLeft_.x + 1], new IntVector2(iv2_BottomLeft_.x + 1, iv2_BottomLeft_.y + 1)); } #endregion // Play Sound Effect go_ThemeManager.GetComponent<Cs_AudioManager>().Play_SoundEffect(Enum_SoundEffect.RotateClockwise); } }