void FixedUpdate() { if (joycons.Count > 0) { Joycon j = joycons [jc_ind]; if (j.GetButtonUp(Joycon.Button.SHOULDER_2)) { ActiveBag.Throw(j); } if (j.GetButtonDown(Joycon.Button.DPAD_UP)) { ActiveBag.Reset(); } if (j.GetButton(Joycon.Button.DPAD_LEFT)) { ActiveBag.Move(false); } if (j.GetButton(Joycon.Button.DPAD_RIGHT)) { ActiveBag.Move(true); } if (j.GetButtonDown(Joycon.Button.DPAD_DOWN)) { ActiveBag = gameObject.AddComponent <Application.Bag>(); } // if (j.GetButton(Joycon.Button.STICK)) { // var stickX = j.GetStick()[0]; // if (Mathf.Abs(stickX) > 0.2) { // rotateBag(stickX); // } // } } }
public static bool GetJoyConButtonDown(Joycon.Button button, bool isUsingRightJoyCon = true) { if (isUsingRightJoyCon) { if (m_joyconR == null) { return(false); } else { return(m_joyconR.GetButtonDown(button)); } } else { if (m_joyconL == null) { return(false); } else { return(m_joyconL.GetButtonDown(button)); } } }
private void mouvementJoycon() { // Pour changer de mode de controle. if (j.GetButtonDown(Joycon.Button.DPAD_DOWN)) { mode = (int)ModeControles.DETECTION; } if (j.GetButtonDown(Joycon.Button.DPAD_UP)) { mode = (int)ModeControles.ANALOGIQUE; } if (mode == (int)ModeControles.DETECTION) { accel = j.GetAccel(); //Arrondissement à la décimale inférieure (pour limiter les tremblements) float x = (float)((int)(accel.x * 100)) / 100; float y = (float)((int)(accel.y * 100)) / 100; gameObject.transform.rotation = Quaternion.Euler(y * vitesse, 180, x * vitesse); } else if (mode == (int)ModeControles.ANALOGIQUE) { stick = j.GetStick(); gameObject.transform.rotation = Quaternion.Euler(-j.GetStick()[0] * vitesse, 180, -j.GetStick()[1] * vitesse); } }
void WhoAmI() { if (current.GetButtonDown(Joycon.Button.MINUS) || current.GetButtonDown(Joycon.Button.PLUS)) { print("Player" + (playerName + 1)); StartCoroutine(slowVibrations()); } }
// Update is called once per frame void Update() { // make sure the Joycon only gets checked if attached if (joycons.Count > 0) { j = joycons[jc_ind]; // GetButtonDown checks if a button has been pressed (not held) if (j.GetButtonDown(Joycon.Button.SHOULDER_2)) { Debug.Log("Shoulder button 2 pressed"); // GetStick returns a 2-element vector with x/y joystick components Debug.Log(string.Format("Stick x: {0:N} Stick y: {1:N}", j.GetStick()[0], j.GetStick()[1])); // Joycon has no magnetometer, so it cannot accurately determine its yaw value. Joycon.Recenter allows the user to reset the yaw value. j.Recenter(); } // GetButtonDown checks if a button has been released if (j.GetButtonUp(Joycon.Button.SHOULDER_2)) { Debug.Log("Shoulder button 2 released"); } // GetButtonDown checks if a button is currently down (pressed or held) if (j.GetButton(Joycon.Button.SHOULDER_2)) { Debug.Log("Shoulder button 2 held"); } if (j.GetButtonDown(Joycon.Button.DPAD_DOWN)) { Debug.Log("Rumble"); // Rumble for 200 milliseconds, with low frequency rumble at 160 Hz and high frequency rumble at 320 Hz. For more information check: // https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md j.SetRumble(30, 130, 2f, 100); // The last argument (time) in SetRumble is optional. Call it with three arguments to turn it on without telling it when to turn off. // (Useful for dynamically changing rumble values.) // Then call SetRumble(0,0,0) when you want to turn it off. } stick = j.GetStick(); // Gyro values: x, y, z axis values (in radians per second) gyro = j.GetGyro(); // Accel values: x, y, z axis values (in Gs) accel = j.GetAccel(); orientation = j.GetVector(); orientation = Quaternion.Inverse(new Quaternion(orientation.x, orientation.z, orientation.y, orientation.w)); orientationXYZ = orientation.eulerAngles; orientationXYZ = new Vector3(orientationXYZ.x, orientationXYZ.y, orientationXYZ.z); gameObject.transform.localRotation = Quaternion.Euler(orientationXYZ); } }
void Input() { Joycon j = joycons[jcIndex]; //Al pulsar el boton PLUS o MINUS (depende del mando que se este usando) if (j.GetButtonDown(Joycon.Button.PLUS) || j.GetButtonDown(Joycon.Button.MINUS)) { //Activa el booleano para poder recoger la aceleracion en ColletData pressed = true; // Joycon has no magnetometer, so it cannot accurately determine its yaw value. Joycon.Recenter allows the user to reset the yaw value. j.Recenter(); } }
private void handleInput() { // If both buttons are pressed if (rightJoycon.GetButton(Joycon.Button.SR) && leftJoycon.GetButton(Joycon.Button.SL)) { // Begin recording if (!recording) { BeginRecording(); Debug.Log("Start Recording"); } } // If the buttons are let go else { // Stop recording if (recording) { EndRecording(); Debug.Log("End Recording" + " | Count: " + recordingBuffer.Count); } } if (rightJoycon.GetButtonDown(Joycon.Button.HOME) && recordingBuffer.Count > 0) { gesture.data.Add(new List <Gesture.DataPoint>(recordingBuffer)); gesture.SaveData(); Debug.Log(gesture.GetStatus()); recordingBuffer.Clear(); } }
void FixedUpdate() { if (joycons.Count > 0) { Joycon j = joycons [jc_ind]; if (j.GetButtonUp(Joycon.Button.SHOULDER_2)) { Debug.Log("Shoulder button 2 released"); rb.useGravity = true; //Debug.Log (transform.forward); accel = j.GetAccel(); Debug.Log(accel); // Joycon x axis is the same as Unity's y axis float upForce = System.Math.Abs(accel.x); // Joycon z axis is the same as Unity's z axis float forwardForce = System.Math.Abs(accel.z); Vector3 force = new Vector3(0, upForce, forwardForce) * thrust; rb.AddForce(force); } if (j.GetButtonDown(Joycon.Button.DPAD_UP)) { reset(); } } }
// Update is called once per frame void Update() { if (isMoving) { transform.position = new Vector3(playerTrfm.position.x + posXfromPlayer, transform.position.y, transform.position.z); chargeTime += Time.deltaTime; if (chargeTime >= attackInterval) { Attack(); chargeTime %= attackInterval; } } // ジョイコンで回転させる //rb.MoveRotation(actionInput.GetJoyconAngle() + startAngle); //koitan if (m_joyconR == null) { var joycons = JoyconManager.Instance.j; m_joyconR = joycons.Find(c => !c.isLeft); return; } if (m_joyconR.GetButtonDown(Joycon.Button.SHOULDER_2)) { m_joyconR.Recenter(); } }
// Update is called once per frame void Update() { if (joycons == null || joycons.Count <= 0) { Debug.Log("null"); return; } GetAngles(); float accel = GetMagnitudeOfAccel(); // Debug.Log(accel); // prevent calling ScatterAsh() more than once by using didScattered if (accel >= 2.0f && didScattered == false) { ScatterAsh(); // Debug.Log("Scatter"); didScattered = true; } if (accel < 2.0f) { didScattered = false; } if (joycon.GetButtonDown(Joycon.Button.DPAD_UP)) { Retry(); } }
void ChoixSommetJoycon() { if (mode == (int)Modes.MODIFICATION) { /* On peut changer de sommet si aucun n'a été sélectionné */ if (!sommet.GetComponent <Vertex>().isSelected()) { stick = j.GetStick(); /* On doit relâcher le stick entre deux changements de sommets. */ if (stick[1] < 0.5 && stick[1] > -0.5) { stickPushed = false; } /* Si le stick est incliné */ if ((j.isLeft && stick[1] < -0.5 && !stickPushed) || (!j.isLeft && stick[1] > 0.5 && !stickPushed)) { sommet.GetComponent <MeshRenderer>().material.color = couleurSommet; // Le sommet précédent redevient de couleur normale. sommet = selection.GetComponent <ChangeMesh>().getNextVertex(); // On récupère le sommet suivant. sommet.GetComponent <MeshRenderer>().material.color = Color.yellow; // On change la couleur du sommet pour le mettre en évidence. stickPushed = true; } else if ((!j.isLeft && stick[1] < -0.5 && !stickPushed) || (j.isLeft && stick[1] > 0.5 && !stickPushed)) { sommet.GetComponent <MeshRenderer>().material.color = couleurSommet; sommet = selection.GetComponent <ChangeMesh>().getPreviousVertex(); // On récupère le sommet précédent. sommet.GetComponent <MeshRenderer>().material.color = Color.yellow; stickPushed = true; } if ((j.isLeft && j.GetButtonDown(Joycon.Button.DPAD_DOWN)) || (!j.isLeft && j.GetButtonDown(Joycon.Button.DPAD_UP))) // On valide le sommet voulu. { sommet.GetComponent <Vertex>().setSelected(true); sommet.GetComponent <MeshRenderer>().material.color = Color.white; // On change à nouveau la couleur. } } else { if ((!j.isLeft && j.GetButtonDown(Joycon.Button.DPAD_DOWN)) || (j.isLeft && j.GetButtonDown(Joycon.Button.DPAD_UP))) // On déselectionne le sommet. { sommet.GetComponent <Vertex>().setSelected(false); sommet.GetComponent <MeshRenderer>().material.color = Color.yellow; } } } }
// Update is called once per frame void Update() { // make sure the Joycon only gets checked if attached if (joycon != null) { // GetButtonDown checks if a button has been pressed (not held) if (joycon.GetButtonDown(Joycon.Button.SHOULDER_1)) { // Joycon has no magnetometer, so it cannot accurately determine its yaw value. Joycon.Recenter allows the user to reset the yaw value. joycon.Recenter(); } stick = joycon.GetStick(); // Gyro values: x, y, z axis values (in radians per second) gyro = joycon.GetGyro(); gyroMagnitude = gyro.magnitude; // Accel values: x, y, z axis values (in Gs) accel = joycon.GetAccel(); accelMagnitude = accel.magnitude; // fix rotation orientation = joycon.GetVector(); // orientation = new Quaternion(orientation.x, orientation.z, orientation.y, orientation.w); // Quaternion quat = Quaternion.Inverse(orientation); // Vector3 rot = quat.eulerAngles; // rot += rotationOffset; // orientation = Quaternion.Euler(rot); // rotation = orientation.eulerAngles; if (joyconType == JoyconManager.JoyconType.left) { gameObject.transform.rotation = Quaternion.Euler(0, Mathf.Abs(orientation.x) * 180 - 90, 0); } if (joyconType == JoyconManager.JoyconType.right && accelMagnitude > forceNeeded && !cooldown) { //#if UNITY_STANDALONE_WIN voiceR.Reload(); //#endif cooldown = true; StartCoroutine(BeenSwung()); } // rumble info // https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md // The last argument (time) in SetRumble is optional. Call it with three arguments to turn it on without telling it when to turn off. // (Useful for dynamically changing rumble values.) // Then call SetRumble(0,0,0) when you want to turn it off. IEnumerator BeenSwung() { yield return(new WaitForSeconds(cooldownLenght)); cooldown = false; } } }
// Update is called once per frame void Update() { if (!bug) { float lsx = jg.GetStick()[0], lsy = jg.GetStick()[1], rsx = jd.GetStick()[0], rsy = jd.GetStick()[1]; stickMovements(lsx, lsy, rsx, rsy, 25f); //Bouton X pressé et il est encore possible de changer de matériau. if (jd.GetButtonDown(Joycon.Button.DPAD_UP) && (changeMat)) { switchMaterial(); } //Bouton A pressé et possibilité de créer un clone. if (jd.GetButtonDown(Joycon.Button.DPAD_RIGHT) && (!copy)) { StartCoroutine("createClone"); } //Bouton Flèche haute pressé et il est encore possible de changer de matériau. if (jg.GetButtonDown(Joycon.Button.DPAD_UP) && (changeMat)) { Transform canvas = gameObject.transform.GetChild(0).GetChild(0); int nbgen = canvas.GetComponent <MG_Life_Canvas>().getNbGen(); canvas.GetComponent <MG_Life_Canvas>().setNbGen(nbgen + 1); } //Bouton Flèche bas pressé et possibilité de changer de matériau. if (jg.GetButtonDown(Joycon.Button.DPAD_DOWN) && (changeMat)) { Transform canvas = gameObject.transform.GetChild(0).GetChild(0); int nbgen = canvas.GetComponent <MG_Life_Canvas>().getNbGen(); canvas.GetComponent <MG_Life_Canvas>().setNbGen(nbgen - 1); } //Bouton B pressé. On supprime tout les clones générés et on peut de nouveau changer de matériau. if (jd.GetButtonDown(Joycon.Button.DPAD_DOWN)) { GameObject[] objects = GameObject.FindGameObjectsWithTag("Copy"); foreach (GameObject go in objects) { Destroy(go); } if (!changeMat) { changeMat = true; } } } }
protected virtual void SplashInput() { if (transform.tag == "Player1" && JoycoCount > 0) { if (Joycon1_Right.GetButtonDown(Joycon.Button.DPAD_RIGHT) || Input.GetKeyDown(splashInput)) { cc.Splash(true); } else if (Joycon1_Right.GetButtonUp(Joycon.Button.DPAD_RIGHT) || Input.GetKeyUp(splashInput)) { cc.Splash(false); } //if (Input.GetKeyDown(splashInput) || Input.GetKeyDown(KeyCode.JoystickButton0)) // cc.Splash(true); //else if (Input.GetKeyUp(splashInput) || Input.GetKeyUp(KeyCode.JoystickButton0)) // cc.Splash(false); } else if (transform.tag == "Player2" && JoycoCount == 4) { if (Joycon2_Right.GetButtonDown(Joycon.Button.DPAD_RIGHT)) { cc.Splash(true); } else if (Joycon2_Right.GetButtonUp(Joycon.Button.DPAD_RIGHT)) { cc.Splash(false); } } else { if (Input.GetKeyDown(splashInput)) { cc.Splash(true); } else if (Input.GetKeyUp(splashInput)) { cc.Splash(false); } } //if (m_Input.GetComponent<JoyconInput>().GetTrigger(Joycon.Button.DPAD_RIGHT, m_PlayerIdx, false)) //{ // Debug.Log("s"); //} }
public bool GetKeyDown(Joycon.Button button, bool isLeft) { if (isLeft) { return(m_joyconL.GetButtonDown(button)); } else { return(m_joyconR.GetButtonDown(button)); } }
public void TranslateArm() { if (currentJoycon.GetButtonDown(Joycon.Button.DPAD_UP)) { isTranslateArm = true; transform.position = endCourse.transform.position; } else if (currentJoycon.GetButtonUp(Joycon.Button.DPAD_UP)) { isTranslateArm = false; transform.position = initPosition; } }
private void Mouvements() { float h, v; if (joycons.Count > 0) { if (j.isLeft) { h = -j.GetStick()[1] * vitesseH; v = j.GetStick()[0] * vitesseV; aim = j.GetButtonDown(Joycon.Button.DPAD_DOWN); } else { h = j.GetStick()[1] * vitesseH; v = -j.GetStick()[0] * vitesseV; aim = j.GetButtonDown(Joycon.Button.DPAD_UP); } } else { h = Input.GetAxis("Horizontal") * vitesseH; v = Input.GetAxis("Vertical") * vitesseV; aim = Input.GetButtonDown("Fire2"); } /* Pour bloquer la position entre les limites en hauteur. */ if (transform.position.y <= HauteurMin && v < 0) { v = 0; } else if (transform.position.y >= HauteurMax && v > 0) { v = 0; } transform.rotation = Quaternion.Euler(0, h + transform.rotation.eulerAngles.y, 0); transform.position += new Vector3(0, v); }
private void FixedUpdate() { if (joycons.Count > 0) { Joycon j = joycons[jc_ind]; if (j.GetButtonDown(Joycon.Button.SHOULDER_2)) { playerController.Attack(); } orientation = j.GetVector(); orientation.x += offset; transform.rotation = orientation; } }
// Update is called once per frame void Update() { // make sure the Joycon only gets checked if attached if (joycons.Count > 0) { Joycon j = joycons [jc_ind]; // GetButtonDown checks if a button has been pressed (not held) if (j.GetButtonDown(Joycon.Button.SHOULDER_2)) { // Joycon has no magnetometer, so it cannot accurately determine its yaw value. Joycon.Recenter allows the user to reset the yaw value. j.Recenter(); } } }
void FixedUpdate() { gameObject.transform.rotation = Quaternion.Euler(90, 0, 0) * j.GetVector(); //switch coordinate systems if (j.GetButtonDown(Joycon.Button.SHOULDER_1)) //reset // GetStick returns a 2-element vector with x/y joystick components { Debug.Log(string.Format("Stick x: {0:N} Stick y: {1:N}", j.GetStick()[0], j.GetStick()[1])); // Joycon has no magnetometer, so it cannot accurately determine its yaw value. Joycon.Recenter allows the user to reset the yaw value. j.Recenter(); } if (j.GetButtonDown(Joycon.Button.SHOULDER_2)) //capture { if (currMove != null) { currMove.StopMove(); currMove = null; } else { RaycastHit hit; if (Physics.Raycast(transform.position, transform.forward, out hit)) { Moveable move = hit.transform.GetComponent <Moveable>(); if (move != null) { move.StartMove(j); currMove = move; } } } } float[] movement = j.GetStick(); }
private void Update() { var orientation = m_joyconR.GetVector().eulerAngles; var angles = transform.localEulerAngles; angles.z = orientation.y; transform.localEulerAngles = angles; if (m_joyconR.GetButtonDown(Joycon.Button.SHOULDER_2)) { m_joyconR.Recenter(); } transform.position = new Vector3(0, m_joyconR.GetAccel().magnitude - 1, 0); }
private void Update() { //m_joyconL.SetRumble( 160, 320, 0.6f, 200 ); // 振動 m_pressedButtonL = null; m_pressedButtonR = null; if (m_joyconL.GetButtonDown(Joycon.Button.DPAD_RIGHT)) { // number = Random.Range(0, Train.Length); Instantiate(Train[0], transform.position, transform.rotation); // 右ボタンが押された // number = Random.Range(0, Train.Length); //Instantiate(Train[number], transform.position, transform.rotation); } if (m_joycons == null || m_joycons.Count <= 0) { return; } foreach (var button in m_buttons) { if (m_joyconL.GetButton(button)) { m_pressedButtonL = button; } if (m_joyconR.GetButton(button)) { m_pressedButtonR = button; } } if (Input.GetKeyDown(KeyCode.Z)) { m_joyconL.SetRumble(160, 320, 0.6f, 200); } if (Input.GetKeyDown(KeyCode.X)) { m_joyconR.SetRumble(160, 320, 0.6f, 200); } }
public void UseCameraButton() { // make sure the Joycon only gets checked if attached if (joycons.Count > 0) { Joycon j = joycons [jc_ind]; if (j.GetButtonDown(Joycon.Button.SHOULDER_1)) { // Joycon has no magnetometer, so it cannot accurately determine its yaw value. Joycon.Recenter allows the user to reset the yaw value. manager.RecalibrateJoycons(); SetCanMove(false); } else if (j.GetButtonUp(Joycon.Button.SHOULDER_1)) { manager.RecalibrateJoycons(); SetCanMove(true); } } }
// Update is called once per frame void Update() { if (story.activeSelf) { if (j.GetButtonDown(Joycon.Button.DPAD_DOWN) || j.GetButtonDown(Joycon.Button.DPAD_UP) || j.GetButtonDown(Joycon.Button.DPAD_RIGHT) || j.GetButtonDown(Joycon.Button.DPAD_LEFT)) { SceneManager.LoadScene(scene1Index); } } else { if (j.GetButtonDown(Joycon.Button.DPAD_DOWN) || j.GetButtonDown(Joycon.Button.DPAD_UP) || j.GetButtonDown(Joycon.Button.DPAD_RIGHT) || j.GetButtonDown(Joycon.Button.DPAD_LEFT)) { story.SetActive(true); } } }
// Update is called once per frame void Update() { if (joycons.Count > 0) { //Modifie l'orientation du tampon (Axe Y) selon l'axe Z du gyroscope float orientation = j.GetGyro().z; if (!jumpMode) { gameObject.transform.Rotate(new Vector3(0, orientation, 0)); } //Si le bouton "Flèche vers le haut" est pressé et que le tampon n'est pas en plein animation, on fait bouger le tampon. if ((j.GetButtonDown(Joycon.Button.DPAD_UP)) && !jumpMode) { jumpMode = true; Debug.Log("JUMP !"); sInstance.setTamponRotation(gameObject.transform.rotation.eulerAngles.y); //Pour que l'animation de mouvement ne se fasse pas instantanément, on utilise //une fonction de co-routine jumpAnim et on l'appelle avec StartCoroutine. StartCoroutine(jumpAnim()); } } }
// Update is called once per frame void Update() { // make sure the Joycon only gets checked if attached if (joycon != null) { // GetButtonDown checks if a button has been pressed (not held) if (joycon.GetButtonDown(Joycon.Button.SHOULDER_1)) { // Joycon has no magnetometer, so it cannot accurately determine its yaw value. Joycon.Recenter allows the user to reset the yaw value. joycon.Recenter(); } stick = joycon.GetStick(); // Gyro values: x, y, z axis values (in radians per second) gyro = joycon.GetGyro(); gyroMagnitude = gyro.magnitude; // Accel values: x, y, z axis values (in Gs) accel = joycon.GetAccel(); accelMagnitude = accel.magnitude; // fix rotation orientation = joycon.GetVector(); orientation = new Quaternion(orientation.x, orientation.z, orientation.y, orientation.w); Quaternion quat = Quaternion.Inverse(orientation); Vector3 rot = quat.eulerAngles; rot += rotationOffset; orientation = Quaternion.Euler(rot); rotation = orientation.eulerAngles; // rumble info // https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md // The last argument (time) in SetRumble is optional. Call it with three arguments to turn it on without telling it when to turn off. // (Useful for dynamically changing rumble values.) // Then call SetRumble(0,0,0) when you want to turn it off. } }
public bool GetAnyButtonDown() { if (m_joyconL == null) { return(false); } if (m_joyconL.GetButtonDown(Joycon.Button.SHOULDER_1) || m_joyconL.GetButtonDown(Joycon.Button.SHOULDER_2) || m_joyconL.GetButtonDown(Joycon.Button.DPAD_UP) || m_joyconL.GetButtonDown(Joycon.Button.DPAD_DOWN) || m_joyconL.GetButtonDown(Joycon.Button.DPAD_LEFT) || m_joyconL.GetButtonDown(Joycon.Button.DPAD_RIGHT)) { return(true); } else { return(false); } }
void OnTriggerStay2D(Collider2D theCol) { Joycon j = joycons [jc_ind]; if (theCol.gameObject.CompareTag("SonObj")) { //Debug.Log("THIS IS THE BODY"); //Debug.Log(Vector3.Dot(theCol.transform.up, transform.up)); if (Vector3.Dot(theCol.transform.up, transform.up) <= -Threshold) { if (j.GetButtonDown(Joycon.Button.SHOULDER_2) && !isCuttingAnim) { Debug.Log("Shoulder button 2 pressed"); j.SetRumble(160, 320, 0.6f, 200); Destroy(theCol.gameObject); isCuttingAnim = true; } else { isCuttingAnim = false; } } } }
// Update is called once per frame void Update() { if (jd != null) { //Bouton A (Joycon Droit) if (jd.GetButtonDown(Joycon.Button.DPAD_RIGHT)) { if ((!rs) && (!us)) { StartCoroutine("retractSupport"); } } if (jd.GetButtonUp(Joycon.Button.DPAD_RIGHT)) { if (!us) { StopCoroutine("retractSupport"); if (rs) { rs = false; } StartCoroutine("unleashSupport"); } } if (gameObject.transform.position.y > spawnPos.y) { //On replace le palet exactement à sa position initiale (pour éviter que la bille ne se trouve //en dessous du palet lors de sa réapparition suite à une défaite) gameObject.transform.position = spawnPos; } } else { jd = grandfather.getRightJoycon(); } }
// Update is called once per frame void Update() { Debug.Log(base.state); // 進行方向をカメラと同期させる // gameObject.transform.rotation = Soulcamera.transform.rotation; // 回転を制限 gameObject.transform.position = new Vector3(gameObject.transform.position.x, Mathf.Clamp(gameObject.transform.position.y, 0, 0), gameObject.transform.position.z); // HPを更新 hpber.value = soulHP; // 前進(joyconR-ZR) if (m_joyconR.GetButtonDown(Joycon.Button.SHOULDER_2)) { soulVel = 0.08f; text.text = "前進!"; } if (m_joyconR.GetButtonUp(Joycon.Button.SHOULDER_2)) { soulVel = 0.00f; text.text = "停止中"; } // 憑依状態でYを押すと憑依解除 if (base.state == CONDITION.POSSESSION && m_joyconR.GetButton(Joycon.Button.DPAD_LEFT)) { //number.transform.parent = null; // soulConditionFlag = false; base.state = CONDITION.NORMAL; number.GetComponent <numbers>().SetCondition(CONDITION.NOTPOSSESSION); } gameObject.transform.localRotation = new Quaternion(0, -m_joyconL.GetVector().z, 0, m_joyconL.GetVector().w); gameObject.transform.Translate(0, 0, soulVel); }