public void LoadLevel(string name) { //Debug.Log ("Level load requested for: " + name); Application.LoadLevel(name); textControl = GameObject.FindObjectOfType<TextController>(); textControl.PrintLivesLeft(); textControl.PrintScore(); Bricks.breakableCount=0; }
void OnTriggerEnter2D(Collider2D trigger) { //print("Trigger"); // decrese lives until 0 then end levelManager=GameObject.FindObjectOfType<LevelManager>(); textControl=GameObject.FindObjectOfType<TextController>(); ball = GameObject.FindObjectOfType<Ball>(); LevelManager.GameLives--; //Debug.Log (LevelManager.GameLives); if (LevelManager.GameLives <=0) { levelManager.LoadLevel("Lost Game"); } else { ball.BallReset(); textControl.PrintLivesLeft(); } }