private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.name == "Pacman") { if (GameManager.Instance.isSuperPacman) { transform.position = startPos - new Vector3(0, 3, 0); index = 0; GameManager.Instance.score += 500; } else { //hide the Pacman, avoid Destory collision.gameObject.SetActive(false); //game over, hide Panel GameManager.Instance.gamePanel.SetActive(false); Instantiate(GameManager.Instance.gameOverPrefab); #if CELER_ANDROID CelerX.SubmitScore(GameManager.Instance.score); #else //restart scence after 3s Invoke("ReStart", 3f); #endif } } }
public void OnWinButton() { #if CELER_ANDROID CelerX.SubmitScore(score); #else SceneManager.LoadScene(1); #endif }
public void OnExitButton() { #if CELER_ANDROID CelerX.SubmitScore(score); #else Application.Quit(); #endif }
private void Update() { if (pacdotNumber == nowEat && Pacman.GetComponent <PacmanMove>().enabled != false) { gamePanel.SetActive(false); winPrefab.SetActive(true); //取消其他所有协程 StopAllCoroutines(); SetGameState(false); #if CELER_ANDROID CelerX.SubmitScore(score); #else #endif } if (pacdotNumber == nowEat) { // if (Input.GetKey(KeyCode.Z)) { OnPersonaButton(); //Invoke("", 5f); //SceneManager.LoadScene(0); //Application.OpenURL("https://www.cnblogs.com/SouthBegonia"); } if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Space)) { OnWinButton(); } } if (gamePanel.activeInHierarchy) { remainText.text = "Remain:\n\n" + (pacdotNumber - nowEat); nowText.text = "Eaten:\n\n" + nowEat; scoreText.text = "Score:\n\n" + score; } }