예제 #1
0
    void Update()
    {
        float v = Input.GetAxisRaw("Vertical"); //檢測垂直移動

        if (selectButton.Equals("LoadPage"))    //當打開二級菜單
        {
            if (Input.GetButtonDown("Vertical"))
            {
                doCanceMove(v);
            }
            if (Input.GetButtonDown("Cancel"))
            {
                doCancelLoad();
            }
            if (Input.GetButtonDown("Submit"))
            {
                doSubmitLoad();
            }
        }
        else
        {
            if (Input.GetButtonDown("Vertical"))
            {
                doMove(v);
            }
            if (Input.GetButtonDown("Submit"))
            {
                if (tagIndex == 1)
                {
                    selectButton = "Start";               //Start
                }
                else if (tagIndex == 2)
                {
                    doGameLoad();                    //Load
                }
                else if (tagIndex == 3)
                {
                    selectButton = "Exit";                    //Exit
                }
            }
        }
        //根據selectButton的關鍵字決定要做什麼操作
        if (selectButton.Equals("Start"))
        {
            if (CameraFix.sceneGradientIsStatus("SceneDark"))
            {
                SceneManager.LoadScene(startScene);                                              //新的加找場景方法
            }
            else
            {
                CameraFix.doChangeSceneOn();
            }
        }
        else if (selectButton.Equals("Load"))
        {
            if (CameraFix.sceneGradientIsStatus("SceneDark"))
            {
                SceneManager.LoadScene(startScene);                                              //新的加找場景方法
            }
            else
            {
                CameraFix.doChangeSceneOn();
            }
        }
        else if (selectButton.Equals("Exit"))
        {
            if (CameraFix.sceneGradientIsStatus("SceneDark"))
            {
                Application.Quit();                                              //關閉遊戲
            }
            else
            {
                CameraFix.doChangeSceneOn();
            }
        }
    }
예제 #2
0
 void Start()
 {
     camScript      = GameObject.Find("Camera").GetComponent <CameraFix>();
     current        = GameObject.Find("King");
     camScript.King = current;
 }