// Update is called once per frame void Update() { if (!pauseflag) { 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 (idouchuu == true && nowrotation != acc.getDirection()) //もし移動中じゃないかつスマホの向きが変わっていたら(回転されたら { idouchuu = false; //移動中 nowrotation = acc.getDirection(); //スマホの角度代入 selectDirectionandrange(nowrotation); //上向きに何マス、下向きに何マス移動するかをメモ kaisuuseigen--; ballmove(); //動かす! } if (Vector3.Distance(downvectormokuteki, downvectornow) <= kyoyouhanni && Vector3.Distance(upvectormokuteki, upvectornow) <= kyoyouhanni) //スピードを上げたら、この中の値を大きくしないとだめ! { idouchuu = true; if (nowdownx == goaldownx && nowdowny == goaldowny && nowupx == goalupx && nowupy == goalupy) { clearflag = true; } if (nowdownx == goalupx && nowdowny == goalupy && nowupx == goaldownx && nowupy == goaldowny) { clearflag = true; } } 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; } }
// Update is called once per frame void Update() { houkoudetomatteiruka = true; if (pauseflag == false) { if (gameoverflag == true) {//// } else { if (!is_not_moving && pauseflag) { return; } upvectornow = ballup.transform.position; downvectornow = balldown.transform.position; if (SceneManager.GetActiveScene().name == "tutorial") { if (is_not_moving == true && acc.getDirection() == tutorialSystem.wantAcc) { Debug.Log(tutorialSystem.wantAcc); if (nowrotation != acc.getDirection()) { first = false; } is_not_moving = false; //移動中 nowrotation = acc.getDirection(); //スマホの角度代入 selectDirectionandrange(nowrotation); //上向きに何マス、下向きに何マス移動するかをメモ ballmove(); //動かす! } } else { if (is_not_moving == true && houkoudetomatteiruka && !pauseflag) {//もし移動中じゃないかつスマホの向きが変わっていたら(回転されたら if (nowrotation != acc.getDirection()) { first = false; } is_not_moving = false; //移動中 nowrotation = acc.getDirection(); //スマホの角度代入 selectDirectionandrange(nowrotation); //上向きに何マス、下向きに何マス移動するかをメモ ballmove(); //動かす! } } //ここにおそらくアニメーションやらのコードをいれて、トリガー形式にする。下に書いてあるこーどをかえよう /*if (Vector3.Distance(upvectormokuteki, upvectornow) >= kyoyouhanni) * { * directionup = (upvectormokuteki - upvectornow).normalized; * ballup.transform.Translate(directionup * Time.deltaTime * speed, Space.World); * } * else * { * if (flaga) * { * flaga = false; Debug.Log("flaga"); * * } * } * if (Vector3.Distance(downvectormokuteki, downvectornow) >= kyoyouhanni) * { * directiondown = (downvectormokuteki - downvectornow).normalized; * balldown.transform.Translate(directiondown * Time.deltaTime * speed, Space.World); * } * else * { * if (flagb) * { * flagb = false; Debug.Log("flagb"); * * } * }*/ if (Vector3.Distance(downvectormokuteki, downvectornow) <= kyoyouhanni && Vector3.Distance(upvectormokuteki, upvectornow) <= kyoyouhanni)//スピードを上げたら、この中の値を大きくしないとだめ! { if (!first) { flaga = true; flagb = true; first = true; } if (shougaibutuniatatteruyoflag == true) { // Debug.Log(downvectormokuteki); Debug.Log(downvectornow); restartflag = true; shougaibutuniatatteruyoflag = false; } is_not_moving = true; if (nowdownx == goaldownx && nowdowny == goaldowny && nowupx == goalupx && nowupy == goalupy) { clearflag = true; if (automaticmode) { /*GameObject mapgen = GameObject.Find("mapgenerator"); * timecounter = GameObject.Find("timecounter"); * timecounter.GetComponent<timelimitandmemory>().goalupdate(nannido); * timecounter.GetComponent<timelimitandmemory>().zenkaivoid();*/ SceneManager.LoadScene(scenename); } else { //GameObject clear = GameObject.Find("StageClear"); //clear.GetComponent<StageClear>().clear(); //クリア PlayerPrefs.SetInt(CreateButton.sendStageNum.ToString(), 1); } } if (nowdownx == goalupx && nowdowny == goalupy && nowupx == goaldownx && nowupy == goaldowny) { clearflag = true; if (automaticmode) { /*GameObject mapgen = GameObject.Find("mapgenerator"); * timecounter = GameObject.Find("timecounter"); * timecounter.GetComponent<timelimitandmemory>().goalupdate(nannido); * timecounter.GetComponent<timelimitandmemory>().zenkaivoid();*/ SceneManager.LoadScene(scenename); } else { //GameObject clear = GameObject.Find("StageClear"); //clear.GetComponent<StageClear>().clear(); PlayerPrefs.SetInt(CreateButton.sendStageNum.ToString(), 1); } } } } if (restartflag) { nowrotation = 0; acc.ret = 0; acc.lastTouch = 4; 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; } } }
// 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; } }
// Update is called once per frame void Update() { if (slidebool) { houkoudetomatteiruka = true; } 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); // Debug.Log(nowrotation); if (nowrotation != acc.getDirection() && !houkoudetomatteiruka && !slidebool) { tomatteirutaimu += Time.deltaTime; if (tomatteirutaimu > 0.6f) { houkoudetomatteiruka = true; tomatteirutaimu = 0; } } //if(tutorialSystem.wantAcc==acc.getDirection())Debug.Log(tutorialSystem.wantAcc==acc.getDirection()); if (SceneManager.GetActiveScene().name == "tutorial") { if (idouchuujanai == true && acc.getDirection() == tutorialSystem.wantAcc) { Debug.Log(tutorialSystem.wantAcc); if (nowrotation != acc.getDirection()) { first = false; } idouchuujanai = false; //移動中 nowrotation = acc.getDirection(); //スマホの角度代入 selectDirectionandrange(nowrotation); //上向きに何マス、下向きに何マス移動するかをメモ ballmove(); //動かす! //} } } else { if (idouchuujanai == true && houkoudetomatteiruka && !pauseflag) //もし移動中じゃないかつスマホの向きが変わっていたら(回転されたら { if (nowrotation != acc.getDirection()) { first = false; } idouchuujanai = false; //移動中 nowrotation = acc.getDirection(); //スマホの角度代入 selectDirectionandrange(nowrotation); //上向きに何マス、下向きに何マス移動するかをメモ ballmove(); //動かす! } } if (Vector3.Distance(downvectormokuteki, downvectornow) <= kyoyouhanni && Vector3.Distance(upvectormokuteki, upvectornow) <= kyoyouhanni)//スピードを上げたら、この中の値を大きくしないとだめ! { if (!first) { flaga = true; flagb = true; first = true; } if (shougaibutuniatatteruyoflag == true) { // Debug.Log(downvectormokuteki); Debug.Log(downvectornow); restartflag = true; shougaibutuniatatteruyoflag = false; } if (!slidebool) { houkoudetomatteiruka = false; } idouchuujanai = true; if (nowdownx == goaldownx && nowdowny == goaldowny && nowupx == goalupx && nowupy == goalupy) { clearflag = true; if (automaticmode) { GameObject mapgen = GameObject.Find("mapgenerator"); timecounter = GameObject.Find("timecounter"); timecounter.GetComponent <timelimitandmemory>().goalupdate(nannido); timecounter.GetComponent <timelimitandmemory>().zenkaivoid(); SceneManager.LoadScene(scenename); } else { GameObject clear = GameObject.Find("StageClear"); clear.GetComponent <StageClear>().clear(); } } if (nowdownx == goalupx && nowdowny == goalupy && nowupx == goaldownx && nowupy == goaldowny) { clearflag = true; if (automaticmode) { GameObject mapgen = GameObject.Find("mapgenerator"); timecounter = GameObject.Find("timecounter"); timecounter.GetComponent <timelimitandmemory>().goalupdate(nannido); timecounter.GetComponent <timelimitandmemory>().zenkaivoid(); SceneManager.LoadScene(scenename); } else { GameObject clear = GameObject.Find("StageClear"); clear.GetComponent <StageClear>().clear(); } } } if (Vector3.Distance(upvectormokuteki, upvectornow) >= kyoyouhanni) { directionup = (upvectormokuteki - upvectornow).normalized; ballup.transform.Translate(directionup * Time.deltaTime * speed, Space.World); } else { if (flaga) { flaga = false; Debug.Log("flaga"); HandheldUtil.vibrate(5); } } if (Vector3.Distance(downvectormokuteki, downvectornow) >= kyoyouhanni) { directiondown = (downvectormokuteki - downvectornow).normalized; balldown.transform.Translate(directiondown * Time.deltaTime * speed, Space.World); } else { if (flagb) { flagb = false; Debug.Log("flagb"); HandheldUtil.vibrate(5); } // ballup.transform.position = upvectormokuteki; // balldown.transform.position = downvectormokuteki; } } if (restartflag) { nowrotation = 0; acc.ret = 0; acc.lastTouch = 4; 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; } } }