public void pauseGame() { if (!gamePaused) { Time.timeScale = 0f; GoodBreathText.alpha0(); BadBreathText.alpha0(); } else { Time.timeScale = 1f; } GameObject.FindWithTag("Player").GetComponent <EggControl>().enabled = gamePaused; gamePaused = !gamePaused; }
// Update is called once per frame void Update() { if (focused) { // Either press enter or the device button to submit if ((Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Return) || fd.ButtonDown()) && !Input.GetMouseButtonDown(0) && name.text.Trim() != "") { OnSubmit(); } } else { name.ActivateInputField(); name.text = name.text.Trim(); } // Check if last chance has been used if (!lastChanceTaken) { // Ensure that breath is the best quality if (BreathRecogniser.topQualityBreath) { BadBreathText.alpha0(); HealthControl.lives += 1; Transform Egg = GameObject.Find("Egg").transform; Rigidbody2D rb2d = Egg.GetComponent <Rigidbody2D>(); rb2d.constraints = RigidbodyConstraints2D.None; rb2d.constraints = RigidbodyConstraints2D.FreezeRotation; HealthControl.lifeSpriteArr[0].SetActive(true); Egg.position = new Vector3(OnCollision.lastCollidedPlatform.position.x, OnCollision.lastCollidedPlatform.position.y + 1.5f, OnCollision.lastCollidedPlatform.position.z); OnCollision.lastCollidedPlatform.gameObject.GetComponent <EdgeCollider2D>().enabled = true; Egg.parent = OnCollision.lastCollidedPlatform.gameObject.transform; GameOverMenu.gameIsOver = false; lastChanceTaken = true; orText.enabled = false; lastChanceText.enabled = false; } } }
// Update is called once per frame void Update() { // When game is over if (gameIsOver == true) { gameOverMenuUI.SetActive(true); if (!playedSound) { SoundControl.playGameOverSound(); GoodBreathText.alpha0(); BadBreathText.alpha0(); playedSound = true; } } else { gameOverMenuUI.SetActive(false); playedSound = false; } }
// Update is called once per frame void Update() { // When game is over if (gameIsOver) { gameOverMenuUI.SetActive(true); if (!playedSound) { SoundControl.playGameOverSound(); GoodBreathText.alpha0(); BadBreathText.alpha0(); playedSound = true; } } else { gameOverMenuUI.SetActive(false); playedSound = false; } /*if (gameIsOver) * { * if (FizSession.sets > 0) * { * HealthControl.lives = FizSession.breaths; * FizSession.sets--; * SceneManager.LoadScene("Game"); * LevelGenerator.spawnPosY = -3.8f; * } * else * { * SceneManager.LoadScene("MainMenu"); * } * gameIsOver = false; * }*/ }