Exemple #1
0
    //往左滑 = 往下一顆星球
    public void swipeBefore()
    {
        if (this.transform.GetChild(this.transform.childCount - 1).gameObject.activeSelf)
        {
            Debug.Log("已經到最左邊了");
            return; //在最左邊,不動作
        }
        else
        {
            this.transform.GetChild(currentChoice).gameObject.SetActive(false);                 //隱藏目前星球
            this.transform.GetChild(currentChoice + 1).gameObject.SetActive(true);              //下一個星球開啟
            currentChoice++;
            if (currentChoice == 0)
            {
                arrow.GetChild(1).gameObject.SetActive(false);
            }
            else if (currentChoice == 2)
            {
                arrow.GetChild(0).gameObject.SetActive(false);
            }
            else
            {
                arrow.GetChild(1).gameObject.SetActive(true);
            }

            // Refresh experience
            chooseMode cm = GameObject.Find("GameManager").GetComponent <chooseMode>();
            cm.GetExperience();
        }
    }
Exemple #2
0
    //往右滑 = 回上一顆星球
    public void swipeAfter()
    {
        if (this.transform.GetChild(0).gameObject.activeSelf)
        {
            Debug.Log("已經到最右邊了");
            return;             //在最右邊,不動作
        }
        else
        {
            this.transform.GetChild(currentChoice).gameObject.SetActive(false);                                 //目前隱藏
            this.transform.GetChild(currentChoice - 1).gameObject.SetActive(true);                              //前一個開啟
            currentChoice--;
            if (currentChoice == 0)
            {
                arrow.GetChild(0).gameObject.SetActive(true);
                arrow.GetChild(1).gameObject.SetActive(false);
            }
            else
            {
                arrow.GetChild(0).gameObject.SetActive(true);
            }

            // Refresh experience
            chooseMode cm = GameObject.Find("GameManager").GetComponent <chooseMode>();
            cm.GetExperience();
        }
    }