public void CheckForLevelEnded() { if (levelService.BallCount <= 0 && GameObject.FindGameObjectsWithTag(Tags.BALL).Length == 0) { Instantiate(levelEndedMenuPrefab, new Vector2(), Quaternion.identity); levelService.IsLevelPaused = true; PauseMenuController menuOnScene = FindObjectOfType(typeof(PauseMenuController)) as PauseMenuController; if (menuOnScene != null) { Destroy(menuOnScene.gameObject); } progressService.UpdateScore(levelService.CurrentLevel, levelService.GetStarCount()); progressService.SetStarsCountTotal(); } }