Exemplo n.º 1
0
 void OnDestroy()
 {
     if (this == instance)
     {
         _instance = null;
     }
 }
Exemplo n.º 2
0
 public void restartgameover()
 {
     timee                      = GameObject.Find("timecounter");
     script.clearflag           = false;
     timescript                 = timee.GetComponent <timelimitandmemory>();
     timescript.pauseorquitflag = true;
 }
Exemplo n.º 3
0
 public void restartgameover()//オートマティックモードのときのみ
 {
     audioSource.clip = sound2;
     audioSource.Play();
     timee                      = GameObject.Find("timecounter");
     script.clearflag           = false;
     timescript                 = timee.GetComponent <timelimitandmemory>();
     timescript.pauseorquitflag = true;
 }
Exemplo n.º 4
0
 public void pausebottun()
 {
     audioSource.clip = sound1;
     audioSource.Play();
     if (automaticmode)
     {
         timee      = GameObject.Find("timecounter");
         timescript = timee.GetComponent <timelimitandmemory>();
         if (!timescript.gameoverflag)
         {
             script.pauseflag = true;
         }
     }
     else
     {
         if (!script.clearflag)
         {
             script.pauseflag = true;
         }
     }
 }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        timecounter = GameObject.Find("timecounter");
        if (pauseflag == false)
        {
            if (gameoverflag == true)
            {////
            }
            else
            {
                if (!idouchuujanai && pauseflag)
                {
                    return;
                }
                upvectornow   = ballup.transform.position;
                downvectornow = balldown.transform.position;
                //ballup.transform.position = Vector3.Slerp(upvectornow, upvectormokuteki, Time.deltaTime);//Lerpですすむ、AnimationCurveであとで速さとか調節、第三引数ようわからないのでデバッグ
                // balldown.transform.position = Vector3.Slerp(downvectornow, downvectormokuteki, Time.deltaTime);
                if (idouchuujanai == true && nowrotation != acc.getDirection())                                                                           //もし移動中じゃないかつスマホの向きが変わっていたら(回転されたら
                {
                    idouchuujanai = false;                                                                                                                //移動中
                    nowrotation   = acc.getDirection();                                                                                                   //スマホの角度代入
                    selectDirectionandrange(nowrotation);                                                                                                 //上向きに何マス、下向きに何マス移動するかをメモ
                    kaisuuseigen--;
                    ballmove();                                                                                                                           //動かす!
                }
                if (Vector3.Distance(downvectormokuteki, downvectornow) <= kyoyouhanni && Vector3.Distance(upvectormokuteki, upvectornow) <= kyoyouhanni) //スピードを上げたら、この中の値を大きくしないとだめ!
                {
                    if (shougaibutuniatatteruyoflag == true && idouchuujanai)
                    {
                        Debug.Log(downvectormokuteki); Debug.Log(downvectornow);
                        gameoverflag = true;
                        GameObject         timelimit = GameObject.Find("timecounter");
                        timelimitandmemory script    = timelimit.GetComponent <timelimitandmemory>();
                        script.gameovernisaseru();
                        return;
                    }
                    idouchuujanai = true;
                    if (nowdownx == goaldownx && nowdowny == goaldowny && nowupx == goalupx && nowupy == goalupy)
                    {
                        clearflag = true;
                        timecounter.GetComponent <timelimitandmemory>().zenkaivoid();
                        SceneManager.LoadScene(scenename);
                    }
                    if (nowdownx == goalupx && nowdowny == goalupy && nowupx == goaldownx && nowupy == goaldowny)
                    {
                        clearflag = true;
                        timecounter.GetComponent <timelimitandmemory>().zenkaivoid();
                        SceneManager.LoadScene(scenename);
                    }
                }
                if (Vector3.Distance(upvectormokuteki, upvectornow) >= kyoyouhanni)
                {
                    directionup = (upvectormokuteki - upvectornow).normalized;
                    ballup.transform.Translate(directionup * Time.deltaTime * speed, Space.World);
                }
                if (Vector3.Distance(downvectormokuteki, downvectornow) >= kyoyouhanni)
                {
                    directiondown = (downvectormokuteki - downvectornow).normalized;
                    balldown.transform.Translate(directiondown * Time.deltaTime * speed, Space.World);
                }

                //  ballup.transform.position = upvectormokuteki;
                // balldown.transform.position = downvectormokuteki;
            }
        }
        if (restartflag)
        {
            balldown.transform.position = startdown;
            ballup.transform.position   = startup;
            downvectormokuteki          = startdown;
            downvectornow    = startdown;
            upvectormokuteki = startup;
            upvectornow      = startup;
            nowdownx         = startdownintx;
            nowupx           = startupintx;
            nowdowny         = startdowninty;
            nowupy           = startupinty;
            restartflag      = false;
        }
    }