示例#1
0
    // Update is called once per frame
    void Update()
    {
        //はじめから、つづきから、EXITの選択
        if (select_x_id < 3 && select_x_id >= 0)
        {
            if ((Input.GetAxis("Horizontal") < -0.8f))
            {
                buttondown_now = -1;
                if (buttondown_log != -1)
                {
                    select_x_id--;
                    SE.aS.PlayOneShot(SE.pi1);
                    if (select_x_id == -1)
                    {
                        select_x_id = 2;
                    }
                }
            }
            else
            {
                if ((Input.GetAxis("Horizontal") > 0.8f))
                {
                    buttondown_now = 1;
                    if (buttondown_log != 1)
                    {
                        select_x_id++;
                        SE.aS.PlayOneShot(SE.pi1);
                        if (select_x_id == 3)
                        {
                            select_x_id = 0;
                        }
                    }
                }
                else
                {
                    buttondown_now = 0;
                }
            }
        }



        //難易度の選択
        if (select_x_id < 6 && select_x_id >= 3)
        {
            if ((Input.GetAxis("Vertical") < -0.8f))
            {
                buttondown_now = -1;
                if (buttondown_log != -1)
                {
                    select_x_id++;
                    SE.aS.PlayOneShot(SE.pi1);
                    if (select_x_id == 6)
                    {
                        select_x_id = 5;
                        counter++;
                        if (counter == 100)//100回HARDから下を入力するとでーたが消える
                        {
                            SE.aS.PlayOneShot(SE.exp1);
                            PlayerPrefs.DeleteAll();
                        }
                    }
                }
            }
            else
            {
                if ((Input.GetAxis("Vertical") > 0.8f))
                {
                    buttondown_now = 1;
                    if (buttondown_log != 1)
                    {
                        select_x_id--;
                        SE.aS.PlayOneShot(SE.pi1);
                        if (select_x_id == 2)
                        {
                            select_x_id = 3;
                        }
                    }
                }
                else
                {
                    buttondown_now = 0;
                }
            }
        }



        //決定
        if (Input.GetButtonDown("Jump"))
        {
            //つづきから
            if (select_x_id == 1)
            {
                if (CheckData())
                {
                    SE.aS.PlayOneShot(SE.pi2);
                    select_x_id = 6;
                    GameObject obj = Instantiate(fadeOutfab, new Vector3(0f, 0f, -1.2f), Quaternion.identity);
                    fadeoutcomp = obj.GetComponent <TitleFadeOut>();//
                    flg         = 3;
                }
                else//セーブデータがないなら
                {
                    //ぶぶーの音ならす
                    SE.aS.PlayOneShot(SE.bubu);
                }
            }
            //EXIT
            if (select_x_id == 2)
            {
                SE.aS.PlayOneShot(SE.pi2);
                select_x_id = 6;
                GameObject obj = Instantiate(fadeOutfab, new Vector3(0f, 0f, -1.2f), Quaternion.identity);
                fadeoutcomp = obj.GetComponent <TitleFadeOut>();//
                flg         = 2;
            }

            //EASY
            if (select_x_id == 3)
            {
                SE.aS.PlayOneShot(SE.pi2);
                select_x_id = 6;
                GameObject obj = Instantiate(fadeOutfab, new Vector3(0f, 0f, -1.2f), Quaternion.identity);
                fadeoutcomp     = obj.GetComponent <TitleFadeOut>();                     //
                robj            = GameObject.Find("referobj").GetComponent <Referobj>(); //
                robj.difficulty = 0;
                flg             = 1;
            }
            //NORMAL
            if (select_x_id == 4)
            {
                SE.aS.PlayOneShot(SE.pi2);
                select_x_id = 6;
                GameObject obj = Instantiate(fadeOutfab, new Vector3(0f, 0f, -1.2f), Quaternion.identity);
                fadeoutcomp     = obj.GetComponent <TitleFadeOut>();                     //
                robj            = GameObject.Find("referobj").GetComponent <Referobj>(); //
                robj.difficulty = 1;
                flg             = 1;
            }
            //HARD
            if (select_x_id == 5)
            {
                SE.aS.PlayOneShot(SE.pi2);
                select_x_id = 6;
                GameObject obj = Instantiate(fadeOutfab, new Vector3(0f, 0f, -1.2f), Quaternion.identity);
                fadeoutcomp     = obj.GetComponent <TitleFadeOut>();                     //
                robj            = GameObject.Find("referobj").GetComponent <Referobj>(); //
                robj.difficulty = 2;
                flg             = 1;
            }

            //はじめから
            if (select_x_id == 0)
            {
                SE.aS.PlayOneShot(SE.pi2);
                gameobj_easy.SetActive(true);
                gameobj_norm.SetActive(true);
                gameobj_hard.SetActive(true);
                select_x_id = 4;
            }
        }



        //キャンセルボタンの時
        if (Input.GetButtonDown("Cancel"))
        {
            if (select_x_id < 6 && select_x_id >= 3)
            {
                SE.aS.PlayOneShot(SE.pi2);
                gameobj_easy.SetActive(false);
                gameobj_norm.SetActive(false);
                gameobj_hard.SetActive(false);
                select_x_id = 0;
            }
        }



        //flg = 2のときはEXIT終了
        if (flg == 2)
        {
            if (fadeoutcomp.cnt > 90)
            {
                Application.Quit();
            }
        }

        //flg = 1のときはシーン終了
        if (flg == 1)
        {
            if (fadeoutcomp.cnt > 90)
            {
                SceneManager.LoadScene("prorogue");
            }
        }

        //3のときはつづきから
        if (flg == 3)
        {
            if (fadeoutcomp.cnt > 90)
            {
                SceneManager.LoadScene("stageselect");
            }
        }

        buttondown_log = buttondown_now;
        setpos();
        cnt++;
    }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        if (flg == 0)
        {
            buttondown_now = 0;
            if ((Input.GetAxis("Horizontal") < -0.8f))
            {
                buttondown_now = 1;
                if (buttondown_log != 1)
                {
                    SE.aS.PlayOneShot(SE.pi1);
                    x--;
                }
            }
            if ((Input.GetAxis("Horizontal") > 0.8f))
            {
                buttondown_now = 1;
                if (buttondown_log != 1)
                {
                    SE.aS.PlayOneShot(SE.pi1);
                    x++;
                }
            }
            x = (x + num) % num;

            if ((Input.GetAxis("Vertical") < -0.8f))
            {
                buttondown_now = 1;
                if (buttondown_log != 1)
                {
                    SE.aS.PlayOneShot(SE.pi1);
                    y++;
                }
            }
            if ((Input.GetAxis("Vertical") > 0.8f))
            {
                buttondown_now = 1;
                if (buttondown_log != 1)
                {
                    SE.aS.PlayOneShot(SE.pi1);
                    y--;
                }
            }
            y = (y + maxstage[activedif[x]]) % maxstage[activedif[x]];


            //決定
            if (Input.GetButtonDown("Jump"))
            {
                SE.aS.PlayOneShot(SE.pi2);
                GameObject.Find("referobj").GetComponent <Referobj>().nowstage    = y + 1;//シーン切り替えで引き継ぐ変数の受け渡し
                GameObject.Find("referobj").GetComponent <Referobj>().difficulty  = activedif[x];
                GameObject.Find("referobj").GetComponent <Referobj>().stage_score = stage_score[activedif[x], y];
                GameObject obj = Instantiate(fadeOutfab, new Vector3(0f, 0f, -1.2f), Quaternion.identity);
                fadeoutcomp = obj.GetComponent <TitleFadeOut>();//
                flg         = 1;
            }

            //キャンセルボタンの時
            if (Input.GetButtonDown("Cancel"))
            {
                SE.aS.PlayOneShot(SE.pi2);
                flg = 2;
                GameObject obj = Instantiate(fadeOutfab, new Vector3(0f, 0f, -1.2f), Quaternion.identity);
                fadeoutcomp = obj.GetComponent <TitleFadeOut>();//
            }

            buttondown_log = buttondown_now;
        }
        else//すでに決定orキャンセルしていたら
        {
            //フェードアウト後にステージ変異
            if (fadeoutcomp.cnt == 91)
            {
                if (flg == 1)
                {
                    SceneManager.LoadScene("SampleScene");
                }
                if (flg == 2)
                {
                    SceneManager.LoadScene("TitleScene");
                }
            }
        }

        setpos();
        cnt++;
    }