Esempio n. 1
0
    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
            }
        }
    }
Esempio n. 2
0
    void CelerXMatchListener.onMatchJoined(MatchInfo mathInfo)
    {
        double randomSeed = mathInfo.sharedRandomSeed;

        Debug.Log("random seed " + randomSeed);

        CelerX.Ready();
    }
Esempio n. 3
0
    public void OnWinButton()
    {
#if CELER_ANDROID
        CelerX.SubmitScore(score);
#else
        SceneManager.LoadScene(1);
#endif
    }
Esempio n. 4
0
    public void OnExitButton()
    {
#if CELER_ANDROID
        CelerX.SubmitScore(score);
#else
        Application.Quit();
#endif
    }
    public void OnButtonPress()
    {
        Debug.Log("Button clicked");

#if CELER_ANDROID
        CelerX.PresentSDKUI();
#else
        SceneManager.LoadScene("SampleScene");
#endif

        //gameObject.SetActive(false);
        ////hide current scence
        //canvas.enabled = false;
    }
Esempio n. 6
0
    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;
        }
    }
Esempio n. 7
0
    private void Awake()
    {
        _instance = this;
        int tempCount = rawIndex.Count;

        for (int i = 0; i < tempCount; i++)
        {
            int tempIndex = Random.Range(0, rawIndex.Count);
            usingIndex.Add(rawIndex[tempIndex]);
            rawIndex.RemoveAt(tempIndex);
        }

        foreach (Transform t in GameObject.Find("Maze").transform)
        {
            pacdotGos.Add(t.gameObject);
        }

        pacdotNumber = GameObject.Find("Maze").transform.childCount;

        //since the StartScene has destroyed, must reset the callback here.
        CelerX.SetCallback(this);
    }
 public void Awake()
 {
     CelerX.SetCallback(this);
 }