Пример #1
0
    void HighlightTiles(TileLogic startingTile, bool isAcross)
    {
        //ResetTileColors();
        //UpdateUserGrid();

        string answer = startingTile.acrossAnswer;
        int    offset = 1;

        if (!isAcross)
        {
            offset = (int)Mathf.Sqrt(tiles.Length);
            answer = startingTile.downAnswer;
        }

        List <int> highlightIndices = new List <int>();

        for (int i = 0; i < answer.Length; i++)
        {
            int index = startingTile.index + i * offset;
            highlightIndices.Add(index);
        }

        for (int j = 0; j < tiles.Length; j++)
        {
            TileLogic tl = tiles[j];
            if (tl == null)
            {
                continue;
            }

            if (highlightIndices.Contains(j))
            {
                tl.SetTileColor(highlightedColorBlock, true, userGrid[tl.index]);
            }
            else
            {
                tl.SetTileColor(normalColorBlock, false, userGrid[tl.index]);
            }
        }
    }