// Rotate all of the neighbor directions inside of a single Point public void rotate() { for (int i = 0; i < this.list.Count; i++) { list[i] = TetrisDefinitions.RotateClockWise(list[i]); } }
private bool CheckShape(int i, int j, TetrisDefinitions.Shapes shape) { if (!tileArray[i, j].isPlayerHere()) { return(false); } bool[,] visited = DepthFirstSearch.islandIsTetranimo(tileArray, i, j); if (visited != null) { neighborData = DepthFirstSearch.getListOfNeighbors(visited); if (TetrisDefinitions.CheckForShapeMatch(shape, neighborData)) { return(true); } } return(false); }
// Update is called once per frame void Update() { updateAnimatedTiles(); if (mTTC != null && mTTC.centered) { //loop through all the squares for (int i = 0; i < tileArray.GetLength(0); i++) { for (int j = 0; j < tileArray.GetLength(1); j++) { if (tileArray[i, j].isPlayerHere() && tileArray[i, j].myState != Tile.States.SET) { bool[,] visited = DepthFirstSearch.islandIsTetranimo(tileArray, i, j); if (visited != null) { neighborData = DepthFirstSearch.getListOfNeighbors(visited); if (TetrisDefinitions.CheckForShapeMatch(shape, neighborData) && !checkingShapeInProgress) { checkingShapeInProgress = true; StartCoroutine(constantCheckShape(timeToMakeShape, i, j, visited)); //check that shape holds for set amount of time for (int k = 0; k < tileArray.GetLength(0); k++) { for (int l = 0; l < tileArray.GetLength(1); l++) { if (visited[k, l] == true) { currentTiles.Add(tileArray[k, l]); } } } //add the current shape of tiles to a list } } } } } } pB.setPercent(percentComplete); }