void OnTriggerStay(Collider other) { PlayerContloller controller = other.GetComponent <PlayerContloller>(); if (other.gameObject.name == "Ruby") { if (Input.GetKeyDown("c")) { controller.Move(-1); player.transform.Rotate(0, 90, 0); afterTrigger.transform.Translate(0.0f, 0.0f, -1.5f); transform.Translate(0.0f, 0.0f, -3f); cam.SetBool("0to90Rotator", true); button.SetBool("rotator", true); } } }
void OnTriggerStay(Collider other) { PlayerContloller controller = other.GetComponent <PlayerContloller>(); if (other.gameObject.name == "Ruby") { shijiBox.SetActive(true); textAnimator.SetTrigger("text"); if (Input.GetKeyDown("c")) { controller.Move(2); player.transform.Rotate(0, 90, 0); cam.SetBool("flipCamera2", true); button.SetBool("rotator", true); shijiBox.SetActive(false); Destroy(gameObject); //RCube.transform.LookAt(target); } } }
void OnTriggerStay(Collider other) { PlayerContloller controller = other.GetComponent <PlayerContloller>(); if (other.gameObject.name == "Ruby") { if (Input.GetKeyDown("c")) { if (value.originValue == 1) { controller.Move(0); player.transform.Rotate(0.0f, 90.0f, 0.0f); //afterTrigger.transform.Translate(0.0f, 0.0f, 3.0f); //transform.Translate(0.0f, 0.0f, 1.5f); button1.transform.Translate(2f, 0.0f, 0.0f); button2.transform.Translate(0.0f, 0.0f, 3.0f); cam.SetBool("0to90num2", true); cam.SetBool("-180to-270Rotator", false); button.SetBool("rotator", true); } } } }
void OnTriggerStay(Collider other) { PlayerContloller controller = other.GetComponent <PlayerContloller>(); if (other.gameObject.name == "Ruby") { if (Input.GetKeyDown("c")) { controller.Move(3); player.transform.Rotate(0, 90, 0); //afterTrigger.transform.Translate(0.0f, 0.0f, -30f); //transform.Translate(0.0f, 0.0f, -3f); button1.transform.Translate(0.0f, 0.0f, -1.0f); button2.transform.Translate(-2.0f, 0.0f, 0.0f); cam.SetBool("-180to-270", true); cam.SetBool("-90to-180", false); cam.SetBool("0to-90Rotator", false); originValue = 1; button.SetBool("rotator", true); } } }
// Update is called once per frame void Update() { PlayerContloller controller = player.GetComponent <PlayerContloller>(); //playerのscriptに値を送るために、controllerという変数を宣言する Button.transform.rotation = cam.transform.rotation; //ボタンの正面はカメラをついてくる if (triger.tag == "Stage4Middle") { if (isRot == true) { y += Time.deltaTime * 60.0f; //-90度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(3); //playerControllerスクリプトに1の値を送って、プレイヤーの動きを変える controller.CharaController.enabled = false; if (y >= 90.0f) //is close to the triger tag rigth)//-90度を超えたら回転を止める { isRot = false; controller.CharaController.enabled = true; } } else if (isRot2 == true) //反対側に回転させたい場合 { y += Time.deltaTime * -60.0f; //0度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(0); controller.CharaController.enabled = false; if (y <= 0.0f) { controller.CharaController.enabled = true; isRot2 = false; } } } else if (triger.tag == "Stage4Rigth") { if (value3 == 1) { triger.SetActive(false); } if (isRot == true) { y += Time.deltaTime * -60.0f; //-90度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(0); //playerControllerスクリプトに1の値を送って、プレイヤーの動きを変える controller.CharaController.enabled = false; if (y <= 0.0f) //is close to the triger tag rigth)//-90度を超えたら回転を止める { isRot = false; controller.CharaController.enabled = true; } } else if (isRot2 == true) //反対側に回転させたい場合 { y += Time.deltaTime * 60.0f; //0度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(3); controller.CharaController.enabled = false; if (y >= 90.0f) { controller.CharaController.enabled = true; isRot2 = false; } } } else if (triger.tag == "Stage4Left") { if (isRot == true) { y += Time.deltaTime * 60.0f; //-90度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(2); //playerControllerスクリプトに1の値を送って、プレイヤーの動きを変える controller.CharaController.enabled = false; if (y >= 180.0f) //is close to the triger tag rigth)//-90度を超えたら回転を止める { isRot = false; controller.CharaController.enabled = true; } } else if (isRot2 == true) //反対側に回転させたい場合 { y += Time.deltaTime * -60.0f; //0度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(3); controller.CharaController.enabled = false; if (y <= 90.0f) { controller.CharaController.enabled = true; isRot2 = false; } } } else if (triger.tag == "Stage4LeftBack") { if (isRot == true) { y += Time.deltaTime * 60.0f; //-90度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(1); //playerControllerスクリプトに1の値を送って、プレイヤーの動きを変える controller.CharaController.enabled = false; if (y >= 270.0f) //is close to the triger tag rigth)//-90度を超えたら回転を止める { isRot = false; controller.CharaController.enabled = true; } } else if (isRot2 == true) //反対側に回転させたい場合 { y += Time.deltaTime * -60.0f; //0度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(2); controller.CharaController.enabled = false; if (y <= 180.0f) { controller.CharaController.enabled = true; isRot2 = false; } } } else if (triger.tag == "Stage4Rigth2") { if (isRot == true) { y += Time.deltaTime * 60.0f; //-90度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(0); //playerControllerスクリプトに1の値を送って、プレイヤーの動きを変える controller.CharaController.enabled = false; if (y >= 360.0f) //is close to the triger tag rigth)//-90度を超えたら回転を止める { isRot = false; controller.CharaController.enabled = true; trigerLeft2.SetActive(true);//最初の面に戻るために新しトリガーを使う } } else if (isRot2 == true) //反対側に回転させたい場合 { y += Time.deltaTime * -90.0f; //0度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(1); controller.CharaController.enabled = false; if (y <= 270.0f) { controller.CharaController.enabled = true; isRot2 = false; } } } else if (triger.tag == "Stage4Left2") { if (isRot == true) { y += Time.deltaTime * 60.0f;//-360度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(3); //controller.CharaController.enabled = false; if (y >= 450.0f)//-360度を超えたら回転を止める { //controller.CharaController.enabled = true; isRot = false; value = 0; value2 = 0; value3 = 0; y = 90.0f; trigerLeft2.SetActive(true);//trigleftを発動する triger.SetActive(false); } } } }
void Update() { PlayerContloller controller = player.GetComponent <PlayerContloller>(); //playerのscriptに値を送るために、controllerという変数を宣言する Button.transform.rotation = cam.transform.rotation; //ボタンの正面はカメラをついてくる //if (turnFreezTimer <= 3.0f) //{ // controller.CharaController.enabled = false; // controller.h = 0.0f; // turnFreezTimer += Time.deltaTime; // Debug.Log(turnFreezTimer); // if (turnFreezTimer >= 3.0f) // { // controller.CharaController.enabled = true; // } if (triger.tag == "rigth" || triger.tag == "YellowRound") { //turnFreezTimer = 0.0f; if (isRot == true) { y += Time.deltaTime * -60.0f; //-90度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(1); //playerControllerスクリプトに1の値を送って、プレイヤーの動きを変える if (y <= -90.0f) //is close to the triger tag rigth)//-90度を超えたら回転を止める { isRot = false; buttonAnim.SetBool("rotator", false); //ボタンのアニメーションを発動する } } else if (isRot2 == true) //反対側に回転させたい場合 { y += Time.deltaTime * 60.0f; //0度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(0); if (y >= 0.0f) { isRot2 = false; buttonAnim.SetBool("rotator", false); //ボタンのアニメーションを発動する } } } else if (triger.tag == "AfterYellowRound") { if (isRot == true) { y += Time.deltaTime * 60.0f; //-90度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(3); //playerControllerスクリプトに1の値を送って、プレイヤーの動きを変える if (camOffsetX > -5) { camOffsetX += Time.deltaTime - 1f; cam.GetComponent <CameraFolow>().offset = new Vector3(camOffsetX, 0, -5); } if (y >= 90.0f) //is close to the triger tag rigth)//-90度を超えたら回転を止める { isRot = false; } } else if (isRot2 == true) //反対側に回転させたい場合 { y += Time.deltaTime * -60.0f; //0度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); if (camOffsetX < 5) { camOffsetX += Time.deltaTime + 1f; cam.GetComponent <CameraFolow>().offset = new Vector3(camOffsetX, 0, camOffsetZ); } if (camOffsetZ > -5) { camOffsetZ += Time.deltaTime - 1f; cam.GetComponent <CameraFolow>().offset = new Vector3(camOffsetX, 0, camOffsetZ); } controller.Move(0); if (y <= 0.0f) { isRot2 = false; } } } else if (triger.tag == "InSecondPart") { if (isRot == true) { y += Time.deltaTime * -60.0f; //-90度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(0); //playerControllerスクリプトに1の値を送って、プレイヤーの動きを変える if (y <= 0.0f) //is close to the triger tag rigth)//-90度を超えたら回転を止める { isRot = false; } } else if (isRot2 == true) //反対側に回転させたい場合 { y += Time.deltaTime * 60.0f; //0度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(3); if (y >= 90.0f) { isRot2 = false; } } } }
void Update() { Button.transform.rotation = cam.transform.rotation;//ボタンの正面はカメラをついてくる if (triger == GameObject.FindGameObjectWithTag("rigth")) { if (isRot == true) { y += Time.deltaTime * -90.0f; //-90度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(1); //playerControllerスクリプトに1の値を送って、プレイヤーの動きを変える controller.CharaController.enabled = false; if (y <= -90.0f) //is close to the triger tag rigth)//-90度を超えたら回転を止める { isRot = false; controller.CharaController.enabled = true; } } else if (isRot2 == true) //反対側に回転させたい場合 { y += Time.deltaTime * 60.0f; //0度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(0); controller.CharaController.enabled = false; if (y >= 0.0f) { controller.CharaController.enabled = true; isRot2 = false; } } } //左側 else if (triger == GameObject.FindGameObjectWithTag("left")) { if (value3 == 1) { triger.SetActive(false); } else { if (isRot == true) { y += Time.deltaTime * 60.0f;//90度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(3); controller.CharaController.enabled = false; if (y >= 90.0f)//90度を超えたら回転を止める { controller.CharaController.enabled = true; isRot = false; } } else if (isRot2 == true) { y += Time.deltaTime * -60.0f; cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(0); controller.CharaController.enabled = false; if (y <= 0.0f) { controller.CharaController.enabled = true; isRot2 = false; } } //else if (isRot == false) //{ // return; //} } } //奥側 else if (triger.tag == "bottom") { if (isRot == true) { y += Time.deltaTime * -90.0f;//-180度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(2); controller.CharaController.enabled = false; if (y <= -180.0f)//-180度を超えたら回転を止める { controller.CharaController.enabled = true; isRot = false; } } else if (isRot2 == true) { y += Time.deltaTime * 60.0f; cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(1); controller.CharaController.enabled = false; if (y >= -90.0f) { controller.CharaController.enabled = true; isRot2 = false; } } //else if (isRot == false) //{ // return; //} } else if (triger == GameObject.FindGameObjectWithTag("bottom2")) { if (isRot == true) { y += Time.deltaTime * -90.0f;//-270度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(3); controller.CharaController.enabled = false; if (y <= -270.0f)//-270度を超えたら回転を止める { controller.CharaController.enabled = true; isRot = false; trigerLeft2.SetActive(true);//最初の面に戻るために新しトリガーを使う } } else if (isRot2 == true) { y += Time.deltaTime * 60.0f; cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(2); controller.CharaController.enabled = false; if (y >= -180.0f) { controller.CharaController.enabled = true; isRot2 = false; } } } else if (triger == GameObject.FindGameObjectWithTag("left2")) { if (isRot == true) { y += Time.deltaTime * -90.0f;//-360度までカメラを回転する cam.transform.localRotation = Quaternion.Euler(0.0f, y, 0.0f); controller.Move(0); controller.CharaController.enabled = false; if (y <= -360.0f)//-360度を超えたら回転を止める { controller.CharaController.enabled = true; isRot = false; value = 0; value2 = 0; value3 = 0; y = 0.0f; trigerLeft2.SetActive(true);//trigleftを発動する triger.SetActive(false); } } } }