void OnDestroy() { if (this == instance) { _instance = null; } }
public void restartgameover() { timee = GameObject.Find("timecounter"); script.clearflag = false; timescript = timee.GetComponent <timelimitandmemory>(); timescript.pauseorquitflag = true; }
public void restartgameover()//オートマティックモードのときのみ { audioSource.clip = sound2; audioSource.Play(); timee = GameObject.Find("timecounter"); script.clearflag = false; timescript = timee.GetComponent <timelimitandmemory>(); timescript.pauseorquitflag = true; }
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; } } }
// 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; } }