void GameOverSequence() { _gameManager.GameOver(); _gameOverText.gameObject.SetActive(true); _restartText.gameObject.SetActive(true); StartCoroutine(GameOverFlickerRoutine()); }
public void Damage() { if (_isShieldActive == true) { _isShieldActive = false; _shieldVisualizer.SetActive(false); return; } _lives--; UIManager.reduceLiveDisplay(_lives); if (_lives == 2) { _leftEngine.SetActive(false); } if (_lives == 1) { _rightEngine.SetActive(false); } if (_lives == 0) { _spawnManager.OnPlayerDeath(); Instantiate(_explosion, transform.position, Quaternion.identity); _gameManager.GameOver(); Destroy(this.gameObject, 0.5f); } }
// called instead of displayGameOver so // gameover can flash. public void flashGameOver() { StartCoroutine(displayGameOver()); // Since the game is over, give player // option to restart the game. _retryGameText.gameObject.SetActive(true); _gameManager.GameOver(); }
void Start() { // get a reference to the player script _player = GameObject.Find("Player").GetComponent <Player>(); if (_player == null) { Debug.Log("player is Null."); } _gameOverTextfab.gameObject.SetActive(false); _gameManager = GameObject.Find("Game_Manager").GetComponent <Game_Manager>(); if (_gameManager == null) { Debug.Log("Game Manager is Null."); } _gameManager.GameOver(); }
private void OnCollisionEnter2D(Collision2D collision) { rb.velocity = Vector2.zero; if (collision.gameObject.tag == "Boost") { if (speed < MaxSpeed) { speed += SpeedDif; Destroy(collision.gameObject); } } if (collision.gameObject.tag == "Enemy") { direction = -direction; rb.AddForce(direction * speed * 100); if (speed <= StandardSpeed) { GM.GameOver(); } speed = StandardSpeed; } }
private void GameOverSequence() { StartCoroutine(FlickeringText("Game Over")); _restartText.enabled = true; _gameManager.GameOver(); }
void OnTriggerEnter(Collider Get) { if (Get.tag == "Enemy") { if (p_Move.status != PlayerMoveStatus.Die) { p_Move.status = PlayerMoveStatus.Die; //Get.gameObject.GetComponent<Animation> ().PlayQueued("hit2"); if (p_Sound != null) { p_Sound.SoundPlay(2); Debug.Log("p_sound true"); } if (g_Manager != null) { g_Manager.GameOver(); } // gameObject.SetActive(false); Destroy(gameObject); } } if (Get.tag == "coin") { Get.gameObject.SetActive(false); Get_Coin_Count += 1; if (g_Manager != null) { g_Manager.GetCoin(); } if (p_Sound != null && p_Move.status != PlayerMoveStatus.Die) { p_Sound.SoundPlay(1); } } if (Get.tag == "Diamond") { Get.gameObject.SetActive(false); Get_Coin_Count += 10; if (g_Manager != null) { g_Manager.GetDiamond(); } if (p_Sound != null) { p_Sound.SoundPlay(1); } } if (Get.tag == "DeathZone") { if (p_Move.status != PlayerMoveStatus.Die) { p_Move.status = PlayerMoveStatus.Die; this.gameObject.GetComponent <Rigidbody>().AddForce(0, -50f, 0); if (g_Manager != null) { g_Manager.GameOver(); } if (p_Sound != null) { p_Sound.SoundPlay(2); } } } }