IEnumerator countDownTimer(float timeToFlip)
    {
        float timer = timeToFlip;

        while (timer >= 0)
        {
            pBT.setString(Mathf.Ceil(timer).ToString());
            pB.setPercent(timer / timeToFlip);
            timer -= Time.deltaTime;
            yield return(null);
        }
        foreach (Tile tile in tileList)
        {
            tile.myState = Tile.States.NONE;
            tile.flipped = false;
        }
        pB.setPercent(0f);
    }
Exemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (on)
     {
         checkForOnSelector();
         checkForSelected();
     }
     if (pB != null)
     {
         pB.setPercent(percentage);
     }
 }
    // 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);
    }