private IEnumerator _showPictureFrame() { yield return(new WaitUntil(() => pixelizationCount == 0)); // wait for all cells ready planeBorders.material.DOColor(colorScheme.randomBorderColor, 1f); foreach (GridCell cell in grid.totalCells.OrderBy(rnd => UnityEngine.Random.value)) { if (cell is DefaultCell) { DefaultCell defaultCell = cell as DefaultCell; foreach (Transform cellPart in defaultCell.meshTransforms) { cellPart.DOMove(pictureFrame.transform.position, UnityEngine.Random.Range(.5f, 1f)).SetDelay(UnityEngine.Random.Range(.5f, 2f)).OnStart(() => { cellPart.DOScale(Vector3.zero, 1f).SetEase(Ease.OutCirc); }); } } else { Destroy(cell.gameObject); } } yield return(new WaitForSeconds(.5f)); // confetti for (int i = 0; i < 10; i++) { ParticleSystem confetti = Instantiate(confettiPs, grid.randomCell().transform.position + (Vector3.up * 15f), Quaternion.identity); ParticleSystemRenderer confettiRenderer = confetti.GetComponent <ParticleSystemRenderer>(); confettiRenderer.material = confettiMaterials[UnityEngine.Random.Range(0, confettiMaterials.Length)]; confetti.Play(); } pictureFrame.setSprite(colorPicker.sprite); yield return(new WaitForSeconds(4f)); gameController.uiManager.showEndLevelMenu(); }