private Vector3 handleInit; // initial position of the handle // Start is called before the first frame update void Start() { handleInit = handle.localPosition; handleMaxX = handleInit.x; handleMinX = bottom.localPosition.x; ballScript = pinball.GetComponent <PinballScript>(); }
public static void reset() { print("3 lives gained!"); // Restart game gameOver = false; // Play sound effect source.PlayOneShot(restart, 1.0f); // Reset Lives lives = 3; // Reset the score Score.resetScore(); // Reset Ball GameObject ball = GameObject.FindGameObjectWithTag("Ball"); PinballScript.resetBall(ball); }
// called second void OnSceneLoaded(Scene scene, LoadSceneMode mode) { UIElements.SetActive(scene.buildIndex != 0); player = FindObjectOfType <PinballScript>(); Score = 0; if (livesImages != null) { for (int i = 0; i < StartingLives; i++) { Destroy(livesImages[i]); } } livesImages = new GameObject[StartingLives]; for (int i = 0; i < StartingLives; i++) { livesImages[i] = Instantiate(livesImagePrefab, livesContainer.transform); } lives = StartingLives; bombInput.Reset(); }
// Start is called before the first frame update void Start() { bScript = ball.GetComponent <PinballScript>(); }
// Start is called before the first frame update void Start() { ball = GameObject.Find("Pinball"); ballScript = ball.GetComponent <PinballScript>(); }
// Start is called before the first frame update void Start() { GetComponent <Renderer>().enabled = false; ball = GameObject.Find("Pinball"); ballScript = ball.GetComponent <PinballScript>(); }
// Start is called before the first frame update void Start() { GetComponent <Renderer>().enabled = false; ballScript = ball.GetComponent <PinballScript>(); }