void OnTriggerEnter(Collider other) { BallScript ballScript = other.GetComponent <BallScript>(); if (ballScript) { ballScript.Die(); } }
private void OnTriggerEnter(Collider other) { BallScript ballScript = other.GetComponent <BallScript>(); if (ballScript) { ballScript.Die(); } Debug.Log("LifeLost"); }
void OnTriggerEnter(Collider other) { BallScript bs = other.GetComponent <BallScript> (); if (bs) { bs.Die(); bs.DieForReal(); } }
//If the ball misses the paddle the ball needs to be destroyed void OnTriggerEnter(Collider other) { //Getting the script component from the ball when it collides BallScript ballScript = other.GetComponent <BallScript>(); // call the die function if (ballScript) { ballScript.Die(); } }
// Update is called once per frame void Update() { Text scoreText = GameObject.FindGameObjectWithTag("Score").GetComponent <Text>(); scoreText.text = "Score: " + score; Text brick = GameObject.FindGameObjectWithTag("Aantal").GetComponent <Text>(); brick.text = "Aantal: " + aantalBricks; Text lives = GameObject.FindGameObjectWithTag("LivesText").GetComponent <Text>(); lives.text = "Lives: " + aantalLives; if (aantalBricks == 0) { LevelControllerScript ls = GameObject.Find("LevelController").GetComponent <LevelControllerScript> (); ls.setLevel(1); BallScript bs = GameObject.FindGameObjectWithTag("Ball").GetComponent <BallScript> (); bs.Die(); CreateBrick(); } }