Esempio n. 1
0
    /// <summary>
    /// Merge the tiles and Remove everything from the LinkedList.
    /// </summary>
    public IEnumerator MergeTiles()
    {
        canAdd = false;
        int count = order.Count;
        int index = count;

        for (int i = 0; i < count; i++, index--)
        {
            //Start Removing from the first to the last
            TileBase tile = order.First.Value;
            order.RemoveFirst();
            tile.OnMerge(i);
            //remove from board
            board[tile.row, tile.col].tile = null;
            yield return(new WaitForSeconds(timeMerge));
        }
        canAdd = true;

        StartCoroutine(Collapse());
    }