protected override void ExecutePowerUp() { ball = GameObject.FindGameObjectWithTag("Ball"); if (ball) { paddleController.extraball = true; StartCoroutine(paddleController.SpawnNewBall()); EndPowerUp(); } }
public IEnumerator NextLevel() { yield return(new WaitForSeconds(0.05f)); if (!GameObject.FindGameObjectWithTag("Brick")) { Destroy(ball.transform.parent.gameObject); yield return(new WaitForSeconds(1)); levelNumber++; if (levelNumber <= finalLevel) { brickController.SetUpBricks(levelNumber); StartCoroutine(paddleController.SpawnNewBall()); } else { if (!endless) { Debug.Log("YOU WON!"); VariableHandler variableHandler = variableObject.GetComponent <VariableHandler>(); GameObject scoreObject = GameObject.FindGameObjectWithTag("Score"); ScoreController scoreController = scoreObject.GetComponent <ScoreController>(); variableHandler.finalScore = scoreController.score; variableHandler.winner = true; SceneManager.LoadScene("GameOver"); gameOver = true; } else { brickController.SetUpBricks(finalLevel); StartCoroutine(paddleController.SpawnNewBall()); } } } }