// Update is called once per frame void FixedUpdate() { if (mw.score < -2) { gameOver = true; } scoreText.text = "Score: " + mw.score; if (cameraObject.transform.position.z > playerObject.transform.position.z) { gameOver = true; } if (!gameOver) { ps.handleMovement(playerSpeed + envSpeed + playerRecoverySpeed); // Move the camera and the walls cameraObject.transform.Translate(envSpeed * Time.deltaTime); for (int i = 0; i < walls.Count; i++) { walls[i].transform.Translate(envSpeed * Time.deltaTime); } } else { // Display the gameOver screen: gameOverScript.displayGameOverCanvas(); } }