private void Update() { //tiles start to generate some time before music starts playing and finish generating sometime before music if (gameIsPlaying) { if (!isCurrentTileDequeued) { if (tileQueue.Count == 0 && createdTiles.Count == 0) { ResetGame(); ChangeTileMode(); InitializeGame(); } else { currentTileInfo = tileQueue.Dequeue(); isCurrentTileDequeued = true; } } if (currentTileInfo.tileTimePosStart <= timeTracked && areTilesMoving) { if (currentTileInfo.tile.tileType == TileBaseContainer.TileType.TAP_TILE) { currentTile = Instantiate(tapTilePrefab, GetRandomLane(), Quaternion.identity); createdTiles.Add(currentTile); } else if (currentTileInfo.tile.tileType == TileBaseContainer.TileType.SLIDE_TILE) { currentTile = Instantiate(slideTilePrefab, GetRandomLane(), Quaternion.identity); createdTiles.Add(currentTile); } TileBase tileBase = currentTile.GetComponent <TileBase>(); tileBase.GetTileMapDataFromMap(currentTileInfo.tile); //lastTile = tileBase; if (currentTileInfo.tile.tileType == TileBaseContainer.TileType.SLIDE_TILE) { currentTile.transform.localScale = new Vector3 { x = currentTile.transform.localScale.x, y = tileBase.tileYSize / 10, z = 1 }; } currentTile.transform.position = new Vector3 { x = currentTile.transform.position.x, y = currentTile.transform.position.y + tileBase.tileYSize / 2, z = -2 }; isCurrentTileDequeued = false; } } }