Ejemplo n.º 1
0
    public void FindMatches()
    {
        matchFound = false;

        for (int j = 0; j < grid.gridSize.y; j++)
        {
            for (int i = 0; i < grid.gridSize.x; i++)
            {
                var cont = grid.tokens[j, i].GetComponent <SwapPuzzleTokenController>();
                if (!cont.isMatched)
                {
                    cont.isChecking = true;
                    TokenChain chain = FindMatches(cont, true);
                    if (chain.IsMatchFound())
                    {
                        matchFound = true;
                        tokenChains.Add(chain);
                    }
                    matchFound = chain.IsMatchFound() || matchFound;
                }
            }
        }

        foreach (MaskToken tok in grid.tokens)
        {
            tok.GetComponent <SwapPuzzleTokenController>().isChecking = false;
        }
    }