// Start is called before the first frame update void Start() { transform.position = new Vector3(0, -2.5f, 0); _uiManager = GameObject.Find("Canvas").GetComponent <UIManager>(); _gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); _spawnManager = GameObject.Find("Spawn_Manager").GetComponent <Spawn_Manager>(); _audioSource = GetComponent <AudioSource>(); if (_uiManager != null) { _uiManager.UpdateLives(lives); } if (_spawnManager != null) { _spawnManager.StartSpawn(); } }
private void Update() { if (Input.GetKeyDown(KeyCode.P) && (gameOver == false)) { pauseMenu.SetActive(true); if (pauseMenu.activeInHierarchy == true) { PauseGame(); } if (pauseMenu.activeInHierarchy == false) { ResumeGame(); } } if (gameOver == true) { if (Input.GetKeyDown(KeyCode.R)) { if (isCoopMode == false) { Instantiate(player, Vector3.zero, Quaternion.identity); } if (isCoopMode == true) { Instantiate(coopPlayers, Vector3.zero, Quaternion.identity); } gameOver = false; _uiManager.HideTitle(); _spawnManager.StartSpawn(); } } else if (Input.GetKeyDown(KeyCode.Escape)) { SceneManager.LoadScene("Main_Menu"); } }