bool ScoreLine( Enum_Direction e_Dir_ ) { // Continue from the last-populated position in the list IntVector2 iv2_CurrPos = iv2_PathfindLine[iv2_PathfindLine.Count - 1]; #region If the current X position is the edge of the board, we have a line. Give the player the score. // Check the X coordinate of the current position to determine if we are done // 'i_ArrayWidth - 2' is the far right edge of the board, since we do not include the 'wall mechanic' if(iv2_CurrPos.x == i_ArrayWidth - 2) { // Since we are at the far right edge, we push the list into the 'i_ScoreLine' for (int i_ = 0; i_ < iv2_PathfindLine.Count; ++i_) { iv2_ScoreLine.Add(iv2_PathfindLine[i_]); } // TODO: Apply a score for the user // TODO: Pause gameplay while we run a 'scoreline' visual // (Unknown Remnant) b_AllowedToCheck = true // Return victorious return true; } #endregion #region Else - Continue searching through the board else // We have determined that we need to continue through the board { #region Check Adjacent Blocks // Begin checking to determine the next locations to check bool b_RightFilled = false; bool b_BelowFilled = false; bool b_AboveFilled = false; bool b_LeftFilled = false; // If the space to the right exists, AND // If the space to the right has the same block type AND // We are searching anywhere but where we came from... if( iv2_CurrPos.x + 1 < i_ArrayWidth && GetBlock(iv2_CurrPos.x + 1, iv2_CurrPos.y) == e_CurrBlockType && e_Dir_ != Enum_Direction.Left) { b_RightFilled = true; } // If the space below exists AND // If the space below has the same block type AND // We are searching anywhere but where we came from... if( iv2_CurrPos.y - 1 >= 0 && GetBlock( iv2_CurrPos.x, iv2_CurrPos.y - 1 ) == e_CurrBlockType && e_Dir_ != Enum_Direction.Up ) { b_BelowFilled = true; } // If the space above exists AND // If the space above has the same block type AND // We are searching anywhere but where we came from... if(iv2_CurrPos.y + 1 < i_ArrayHeight && GetBlock( iv2_CurrPos.x, iv2_CurrPos.y + 1 ) == e_CurrBlockType && e_Dir_ != Enum_Direction.Down ) { b_AboveFilled = true; } // If the space to the left exists AND // If the space to the left has the same block type AND // We are searching anywhere but where we came from... if( iv2_CurrPos.x - 1 >= 0 && GetBlock( iv2_CurrPos.x - 1, iv2_CurrPos.y ) == e_CurrBlockType && e_Dir_ != Enum_Direction.Right ) { b_LeftFilled = true; } #endregion // Reset b_ShouldContinue; bool b_ShouldContinue = true; #region 'Right Filled' check if(b_RightFilled) { // Set positions to check IntVector2 iv2_RightAbove = new IntVector2(iv2_CurrPos.x + 1, iv2_CurrPos.y + 1); IntVector2 iv2_RightBelow = new IntVector2(iv2_CurrPos.x + 1, iv2_CurrPos.y - 1); // Check to see if the adjacent positions to the above spot are within the array EXCEPT the last position for(int i_ = 0; i_ < iv2_PathfindLine.Count; ++i_) { // If we ever find a position already stored within, do not continue if( iv2_PathfindLine[i_] == iv2_RightAbove || iv2_PathfindLine[i_] == iv2_RightBelow) { b_ShouldContinue = false; continue; } } // Otherwise, we're good to keep checking in this direction if(b_ShouldContinue) { // Store the new direction (To the right) iv2_PathfindLine.Add(new IntVector2( iv2_CurrPos.x + 1, iv2_CurrPos.y )); // Run another iterative cycle to the right if( ScoreLine( Enum_Direction.Right )) { return true; } } } #endregion // Reset b_ShouldContinue b_ShouldContinue = true; #region 'Below Filled' check if(b_BelowFilled) { // Set positions to check IntVector2 iv2_BelowLeft = new IntVector2(iv2_CurrPos.x - 1, iv2_CurrPos.y - 1); IntVector2 iv2_BelowRight = new IntVector2(iv2_CurrPos.x + 1, iv2_CurrPos.y - 1); // Check to see if the adjacent positions to the above spot are within the array EXCEPT the last position for(int i_ = 0; i_ < iv2_PathfindLine.Count; ++i_) { // If we ever find a position already stored within, do not continue if ( iv2_PathfindLine[i_] == iv2_BelowLeft || iv2_PathfindLine[i_] == iv2_BelowRight ) { b_ShouldContinue = false; } } // Otherwise, we're good to keep checking in this direction if(b_ShouldContinue) { // Store the new direction (Down) iv2_PathfindLine.Add( new IntVector2( iv2_CurrPos.x, iv2_CurrPos.y - 1 )); // Run another iterative cycle downwards if( ScoreLine( Enum_Direction.Down )) { return true; } } } #endregion // Reset b_ShouldContinue b_ShouldContinue = true; #region 'Above Filled' check if (b_AboveFilled) { // Set positions to check IntVector2 iv2_AboveLeft = new IntVector2(iv2_CurrPos.x - 1, iv2_CurrPos.y + 1); IntVector2 iv2_AboveRight = new IntVector2(iv2_CurrPos.x + 1, iv2_CurrPos.y + 1); // Check to see if the adjacent positions to the above spot are within the array EXCEPT the last position for (int i_ = 0; i_ < iv2_PathfindLine.Count; ++i_) { // If we ever find a position already stored within, do not continue if (iv2_PathfindLine[i_] == iv2_AboveLeft || iv2_PathfindLine[i_] == iv2_AboveRight) { b_ShouldContinue = false; continue; } } // Otherwise, we're good to keep checking in this direction if (b_ShouldContinue) { // Store the new direction (Above) iv2_PathfindLine.Add(new IntVector2(iv2_CurrPos.x, iv2_CurrPos.y + 1)); // Run another iterative cycle above if (ScoreLine(Enum_Direction.Up)) { return true; } } } #endregion // Reset b_ShouldContinue b_ShouldContinue = true; #region 'Left Filled' check if (b_LeftFilled) { // Set positions to check IntVector2 iv2_LeftAbove = new IntVector2(iv2_CurrPos.x - 1, iv2_CurrPos.y + 1); IntVector2 iv2_LeftBelow = new IntVector2(iv2_CurrPos.x - 1, iv2_CurrPos.y - 1); // Check to see if the adjacent positions to the above spot are within the array EXCEPT the last position for (int i_ = 0; i_ < iv2_PathfindLine.Count; ++i_) { // If we ever find a position already stored within, do not continue if (iv2_PathfindLine[i_] == iv2_LeftAbove || iv2_PathfindLine[i_] == iv2_LeftBelow) { b_ShouldContinue = false; continue; } } // Otherwise, we're good to keep checking in this direction if (b_ShouldContinue) { // Store the new direction (Left) iv2_PathfindLine.Add( new IntVector2( iv2_CurrPos.x - 1, iv2_CurrPos.y )); // Run another iterative cycle above if (ScoreLine(Enum_Direction.Left)) { return true; } } } #endregion } #endregion // If we got this far, none of the directions worked. Pop off this location and return false. iv2_PathfindLine.RemoveAt(iv2_PathfindLine.Count - 1); return false; }
public static IPosition CreateNew(int x, int y, Enum_Direction direction) { return new Position(x,y, direction); }
public void UpdateDirection(Enum_Direction direction) { _direction = direction; }
public void UpdateDirection(Enum_Direction direction) { if (direction != Enum_Direction.Direction_Error) _roverPosition.UpdateDirection(direction); }
private Position(int x, int y, Enum_Direction direction) { _coordinate = Coordinate.CreateNew(x, y); _direction = direction; }
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); }
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); } }
public void MoveBlock_Dir( Enum_Direction e_MoveDir_, IntVector2 iv2_Pos_ ) { if( e_MoveDir_ == Enum_Direction.Left ) { // Push indicated block model to the left if (DisplayArray_Blocks[iv2_Pos_.y, iv2_Pos_.x].GetComponent<Cs_BlockOnBoardLogic>()) { DisplayArray_Blocks[iv2_Pos_.y, iv2_Pos_.x].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveLeft(); } // Store block to left of this block Enum_BlockType e_TempBlock = DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x - 1]; // Swap Blocks in Array DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x - 1] = DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x + 0]; DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x + 0] = e_TempBlock; // Swap DisplayArray_Blocks in same manner GameObject go_TempBlock = DisplayArray_Blocks[iv2_Pos_.y, iv2_Pos_.x - 1]; DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x - 1] = DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x + 0]; DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x + 0] = go_TempBlock; // Set the Backdrop Color Set_BackdropColor(DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x - 1], new IntVector2( iv2_Pos_.x - 1, iv2_Pos_.y + 0 )); Set_BackdropColor(DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x + 0], new IntVector2(iv2_Pos_.x + 0, iv2_Pos_.y + 0)); if(iv2_Pos_.x + 1 < i_Width) { Set_BackdropColor(Enum_BlockType.Empty, new IntVector2(iv2_Pos_.x + 1, iv2_Pos_.y + 0)); } } else if( e_MoveDir_ == Enum_Direction.Right ) { // Push indicated block to the right if (DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x + 0].GetComponent<Cs_BlockOnBoardLogic>()) { DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x - 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveRight(); } // Store block to the right of this block Enum_BlockType e_TempBlock = DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x + 1]; // Swap Blocks in Array DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x + 1] = DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x - 0]; DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x - 0] = e_TempBlock; // Swap DisplayArray_Blocks in same manner GameObject go_TempBlock = DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x + 1]; DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x + 1] = DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x - 0]; DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x - 0] = go_TempBlock; // Set the Backdrop Color Set_BackdropColor(DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x + 1], new IntVector2(iv2_Pos_.x + 1, iv2_Pos_.y + 0)); Set_BackdropColor(DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x + 0], new IntVector2(iv2_Pos_.x + 0, iv2_Pos_.y + 0)); if (iv2_Pos_.x - 1 > 0) { Set_BackdropColor(Enum_BlockType.Empty, new IntVector2(iv2_Pos_.x - 1, iv2_Pos_.y + 0)); } } else if( e_MoveDir_ == Enum_Direction.Down ) { // Push indicated block to the left if(DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x - 0].GetComponent<Cs_BlockOnBoardLogic>()) { DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x - 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveDown(); } // Store block to the right of this block Enum_BlockType e_TempBlock = DisplayArray[iv2_Pos_.y - 1, iv2_Pos_.x + 0]; // Swap Blocks in Array DisplayArray[iv2_Pos_.y - 1, iv2_Pos_.x + 0] = DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x - 0]; DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x - 0] = e_TempBlock; // Swap DisplayArray_Blocks in same manner GameObject go_TempBlock = DisplayArray_Blocks[iv2_Pos_.y - 1, iv2_Pos_.x + 0]; DisplayArray_Blocks[iv2_Pos_.y - 1, iv2_Pos_.x + 0] = DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x - 0]; DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x - 0] = go_TempBlock; // Set the Backdrop Color Set_BackdropColor(DisplayArray[iv2_Pos_.y - 1, iv2_Pos_.x + 0], new IntVector2(iv2_Pos_.x + 0, iv2_Pos_.y - 1)); Set_BackdropColor(DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x + 0], new IntVector2(iv2_Pos_.x + 0, iv2_Pos_.y + 0)); if(iv2_Pos_.y + 1 < i_Height) { Set_BackdropColor(Enum_BlockType.Empty, new IntVector2(iv2_Pos_.x + 0, iv2_Pos_.y + 1)); } } else if(e_MoveDir_ == Enum_Direction.Up ) { // Push indicated block up if (DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x + 0].GetComponent<Cs_BlockOnBoardLogic>()) { DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x - 0].GetComponent<Cs_BlockOnBoardLogic>().Set_MoveUp(); } // Store block above this block Enum_BlockType e_TempBlock = DisplayArray[iv2_Pos_.y + 1, iv2_Pos_.x + 0]; // Swap Blocks in Array DisplayArray[iv2_Pos_.y + 1, iv2_Pos_.x + 0] = DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x - 0]; DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x - 0] = e_TempBlock; // Swap DisplayArray_Blocks in same manner GameObject go_TempBlock = DisplayArray_Blocks[iv2_Pos_.y + 1, iv2_Pos_.x + 0]; DisplayArray_Blocks[iv2_Pos_.y + 1, iv2_Pos_.x + 0] = DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x - 0]; DisplayArray_Blocks[iv2_Pos_.y + 0, iv2_Pos_.x - 0] = go_TempBlock; // Set the Backdrop Color Set_BackdropColor(DisplayArray[iv2_Pos_.y + 1, iv2_Pos_.x + 0], new IntVector2(iv2_Pos_.x + 0, iv2_Pos_.y + 1)); Set_BackdropColor(DisplayArray[iv2_Pos_.y + 0, iv2_Pos_.x + 0], new IntVector2(iv2_Pos_.x + 0, iv2_Pos_.y + 0)); Set_BackdropColor(Enum_BlockType.Empty, new IntVector2(iv2_Pos_.x + 0, iv2_Pos_.y - 1)); } }