public void LivesCheck() { if (Lives == 2) { Others[3].SetActive(false); } else if (Lives == 1) { Others[4].SetActive(false); } else if (Lives == 0) { Others[5].SetActive(false); if (Score > HScore) { // PlayerPrefs.SetInt("HScore", Score); HighScoreManager(SceneManager.GetActiveScene().buildIndex); } Lives = 3; MaiinPauseButton.GetComponent <Button>().interactable = false; Invoke("GameOver", 1f); Destroy(Instantiate(FinalEffect, Player.position, Quaternion.identity), 2f); Clip_Sounds.PlayOneShot(FinalAttack); } }
void GameOver() { PauseButton = MaiinPauseButton.GetComponent <Button>(); MaiinPauseButton.GetComponent <Button>().interactable = false; PopUpMenu.GetComponent <Animator>().SetBool("pop", true); Time.timeScale = 0; ResumeButton.SetActive(false); ExitControl = true; }
// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.Escape) && !ExitControl) { if (LevelNo != 0 && LevelNo != 1) { ExitControl = true; OnlyForExit = true; Time.timeScale = 0; MaiinPauseButton.GetComponent <Button>().interactable = false; ExitAnim.SetBool("exit", true); } } else if (Input.GetMouseButtonDown(0) && ExitControl && !EventSystem.current.IsPointerOverGameObject()) { if (OnlyForExit) { OnlyForExit = false; Cancel(); } } Score_Text.text = "Score : " + Score.ToString(); }
void GetPauseNExit() { MaiinPauseButton.GetComponent <Button>().interactable = true; ExitControl = false; }