void Start()
 {
     //開始開關(預先開啟GO)
     //StartGameBtn_Go.SetActive(false);
     AllRunkEvent();
     StartGameBtn_Goback.SetActive(false);
 }
    public void StartGameEvent()
    {
        print("開始遊戲");
        ParentCanvasObj.SetActive(false);
        PlayerCanvasObj.SetActive(false);
        ChaserCanvasObj.SetActive(false);
        StartGameBtn_Go.SetActive(false);
        StartGameBtn_Goback.SetActive(false);
        switch (GlobalValue.Map)
        {
        case 0:
            ParentObjList[0].GetComponent <SplineFollower>().followSpeed = 5;
            PlayerObjList[0].GetComponent <SplineFollower>().followSpeed = 5;
            ChaserObjList[0].GetComponent <SplineFollower>().followSpeed = 5;
            print("白天森林關卡");
            break;

        case 1:
            ParentObjList[0].GetComponent <SplineFollower>().spline      = GameObject.Find("Spline2").GetComponent <SplineComputer>();
            PlayerObjList[0].GetComponent <SplineFollower>().spline      = GameObject.Find("Spline2").GetComponent <SplineComputer>();
            ChaserObjList[0].GetComponent <SplineFollower>().spline      = GameObject.Find("Spline2").GetComponent <SplineComputer>();
            ParentObjList[0].GetComponent <SplineFollower>().followSpeed = 6;
            PlayerObjList[0].GetComponent <SplineFollower>().followSpeed = 6;
            ChaserObjList[0].GetComponent <SplineFollower>().followSpeed = 6;
            print("火山關卡");
            break;

        case 2:
            ParentObjList[0].GetComponent <SplineFollower>().spline      = GameObject.Find("Spline2").GetComponent <SplineComputer>();
            PlayerObjList[0].GetComponent <SplineFollower>().spline      = GameObject.Find("Spline2").GetComponent <SplineComputer>();
            ChaserObjList[0].GetComponent <SplineFollower>().spline      = GameObject.Find("Spline2").GetComponent <SplineComputer>();
            ParentObjList[0].GetComponent <SplineFollower>().followSpeed = 6;
            PlayerObjList[0].GetComponent <SplineFollower>().followSpeed = 6;
            ChaserObjList[0].GetComponent <SplineFollower>().followSpeed = 6;
            print("冰原關卡");
            break;

        case 3:
            ParentObjList[0].GetComponent <SplineFollower>().spline      = GameObject.Find("Spline2").GetComponent <SplineComputer>();
            PlayerObjList[0].GetComponent <SplineFollower>().spline      = GameObject.Find("Spline2").GetComponent <SplineComputer>();
            ChaserObjList[0].GetComponent <SplineFollower>().spline      = GameObject.Find("Spline2").GetComponent <SplineComputer>();
            ParentObjList[0].GetComponent <SplineFollower>().followSpeed = 6;
            PlayerObjList[0].GetComponent <SplineFollower>().followSpeed = 6;
            ChaserObjList[0].GetComponent <SplineFollower>().followSpeed = 6;
            print("沙漠關卡");
            break;

        case 4:
            ParentObjList[0].GetComponent <SplineFollower>().followSpeed = 5;
            PlayerObjList[0].GetComponent <SplineFollower>().followSpeed = 5;
            ChaserObjList[0].GetComponent <SplineFollower>().followSpeed = 5;
            print("晚上森林關卡");
            break;
        }
        StartCoroutine(SetStartToMap());
    }
Example #3
0
    public void ChangeMapButtonEvent(int Map)
    {
        VolcanicBtn.GetComponent <Button>().enabled = false;
        IceFieldBtn.GetComponent <Button>().enabled = false;
        DesertBtn.GetComponent <Button>().enabled   = false;
        NightBtn.GetComponent <Button>().enabled    = false;
        switch (Map)
        {
        case 0:
            GlobalValue.Map = Map;
            StartCoroutine(SetTimeFalseActive());
            StartGameBtn_Go.SetActive(true);
            StartGameBtn_Goback.SetActive(false);
            print("更換了白天森林");
            break;

        case 1:
            GlobalValue.Map = Map;
            StartCoroutine(SetTimeFalseActive());
            StartGameBtn_Go.SetActive(false);
            StartGameBtn_Goback.SetActive(true);
            print("更換了火山");
            break;

        case 2:
            GlobalValue.Map = Map;
            StartCoroutine(SetTimeFalseActive());
            StartGameBtn_Go.SetActive(false);
            StartGameBtn_Goback.SetActive(true);
            print("更換了冰原");
            break;

        case 3:
            GlobalValue.Map = Map;
            StartCoroutine(SetTimeFalseActive());
            StartGameBtn_Go.SetActive(false);
            StartGameBtn_Goback.SetActive(true);
            print("更換了沙漠");
            break;

        case 4:
            GlobalValue.Map = Map;
            StartCoroutine(SetTimeFalseActive());
            StartGameBtn_Go.SetActive(true);
            StartGameBtn_Goback.SetActive(false);
            print("更換了晚上森林");
            break;
        }
    }
    public IEnumerator SetStartToMap()
    {
        StartGameBtn_Go.SetActive(false);
        StartGameBtn_Goback.SetActive(false);
        yield return(new WaitForSeconds(3f));//給小雞們跑出畫面的時間

        switch (GlobalValue.Map)
        {
        case 0:
            SceneManager.LoadScene("Forest_Scene");
            //print("白天森林關卡");
            break;

        case 1:
            yield return(new WaitForSeconds(3f));   //給小雞們跑出畫面的時間

            SceneManager.LoadScene("LavaMaze_Scene");
            //print("火山關卡");
            break;

        case 2:
            yield return(new WaitForSeconds(3f));   //給小雞們跑出畫面的時間

            SceneManager.LoadScene("FrostwindMaze");
            //print("冰原關卡");
            break;

        case 3:
            yield return(new WaitForSeconds(3f));   //給小雞們跑出畫面的時間

            SceneManager.LoadScene("DesertMaze_Scene");
            //print("沙漠關卡");
            break;

        case 4:
            SceneManager.LoadScene("ForestNight_Scene");
            //print("晚上森林關卡");
            break;
        }
    }