Exemplo n.º 1
0
    void SpawnNewTilesAndRelocate(List <DoubleInt> tilesCoords)
    {
        DoubleInt grid = bGenerator.Grid;

        for (int y = 0; y < grid.y; y++)
        {
            foreach (var coord in tilesCoords)
            {
                offsetX = currentMatchCountList[y];

                if (coord.y == y)
                {
                    GameObject tileGO;
                    if (cManager.IsTutorial)
                    {
                        tileGO = bGenerator.CreatePresetTile(grid.x + offsetX, coord.x, y);
                    }
                    else
                    {
                        tileGO = bGenerator.CreateTile(grid.x + offsetX, y);
                    }

                    Tile tile = tileGO.GetComponent <Tile>();
                    tile.Coord.x            = coord.x;
                    Board[coord.x, coord.y] = tileGO;

                    tilesToManualMove.Add(tile);

                    currentMatchCountList[y]++;
                }
            }
        }

        MoveAllTilesToItsDesiredLocation();
    }