void Update() { hinput = gamepad.GetStick_L().X; vinput = gamepad.GetStick_L().Y; movement = new Vector3(hinput, 0, vinput).normalized *speed; //print (hinput); //print (vinput); }
void Update() { //Debug.Log(gamepad.GetStick_L().Y); if (((gamepad.GetStick_L().X) > 0.2f || (gamepad.GetStick_L().X) < -0.2f)) { //&& rb.velocity.x<maxSpeed Move(); } if (gamepad.GetButtonDown("A") && !dashOn) { dashOn = true; StartCoroutine(DashTimer()); } if (gamepad.GetStick_L().Y != 0 && onTheWall) { moveDown(); } if (gamepad.GetButton("X")) { Stop(); } if (gamepad.GetButton("Start")) { Scene scene = SceneManager.GetActiveScene(); SceneManager.LoadScene(scene.name); } if (gamepad.GetButtonDown("Y")) { colorChanger.GetComponent <Renderer>().material.SetColor("_Color", Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f)); } }
// Update is called once per frame void Update() { // Sample code to test button input if (gamepad.GetStick_L().X > 0) { print("button pushed"); } // Sample code to test button input if (gamepad.GetStick_L().X < 0) { print("button pushed"); } }
private void Update() { if (!m_Gamepad.IsConnected || characterState == CharacterState.Death || m_ControllerLock) { return; } m_TargetDirection = transform.forward * m_Gamepad.GetStick_L().X *lookAtDirection + transform.up * m_Gamepad.GetStick_L().Y; if (m_Gamepad.GetButtonDown("A") && (m_Controller.isGrounded || m_JumpAirDelayed)) { AkSoundEngine.PostEvent("P" + m_PlayerIndex + "_Jump", gameObject); m_YVelocity = m_JumpInitialVelocity; m_HavePressA = true; m_HaveBeenGrounded = false; } if (m_Gamepad.GetButtonDown("X")) { if (characterState == CharacterState.withEgg) { AkSoundEngine.PostEvent("P" + m_PlayerIndex + "_Throw", gameObject); m_Animator.SetTrigger("Toss"); m_EggController.LaunchEgg((m_TargetDirection) * m_BaseThrowEgg); characterState = CharacterState.withoutEgg; } } if (m_Controller.isGrounded && m_YVelocity < 0) { m_YVelocity = 0; m_HaveBeenGrounded = true; } if (!m_Controller.isGrounded && m_HaveBeenGrounded) { m_JumpAirDelayed = true; m_HaveBeenGrounded = false; } //quick fix to resolve the first frame where the camera dont render the players if (m_Renderer.isVisible) { m_HaveBeenVisible = true; } Debug.Log(m_Renderer.isVisible); if (!m_Renderer.isVisible && m_HaveBeenVisible && !m_invulnaribility) { characterState = CharacterState.Death; } }
// Update is called once per frame void Update() { if (gamepad.GetButtonDown("A")) { StopAllCoroutines(); Debug.Log("oui" + papa); //Debug.Log(papa); } if (gamepad.GetStick_L().X > .9f) { print("owi le stick!"); } }
void CheckInputs() { x = gamepad.GetStick_L().X; y = gamepad.GetStick_L().Y; movement = new Vector3(x, 0, y); if (gamepad.GetButtonDown("A")) { Hide(); rb.velocity = Vector3.zero; } if (hiding) { return; } if (x != 0 || y != 0) { if (anim.GetBool("Walk") == false) { anim.SetBool("Walk", true); } if (dust.isStopped) { dust.Play(); } Rotate(); } else { if (anim.GetBool("Walk")) { anim.SetBool("Walk", false); } if (dust.isPlaying) { dust.Stop(); } /* * if(rb.velocity.magnitude>.5f) * { * rb.velocity /= 2; * } */ } Move(); if (gamepad.GetButtonDown("X") && !attacking) { Attack(); } }
public virtual void RightAndLeft() { #region Keyboard Input if (InputHandler.IsHoldingKey(right)) { keyDirection.x += 1; if (this.gameObject.GetComponent <Player>().identifier == Player.PlayerIdentity.PLAYER_1) { { RightWing.transform.localRotation = Quaternion.Euler(maxXAngle, 0, 0); LeftWing.transform.localRotation = Quaternion.Euler(maxXAngle, 0, 0); } } else { { RightWing.transform.localRotation = Quaternion.Euler(minXAngle, 0, 0); LeftWing.transform.localRotation = Quaternion.Euler(minXAngle, 0, 0); } } } if (InputHandler.IsHoldingKey(left)) { keyDirection.x += -1; if (this.gameObject.GetComponent <Player>().identifier == Player.PlayerIdentity.PLAYER_1) { { RightWing.transform.localRotation = Quaternion.Euler(minXAngle, 0, 0); LeftWing.transform.localRotation = Quaternion.Euler(minXAngle, 0, 0); } } else { { RightWing.transform.localRotation = Quaternion.Euler(maxXAngle, 0, 0); LeftWing.transform.localRotation = Quaternion.Euler(maxXAngle, 0, 0); } } } #endregion #region Gamepad Input if (gamepadInput) { if (Gamepad.GetStick_L().X < 0) //GAMEPAD LEFT { keyDirection.x += -1; if (this.gameObject.GetComponent <Player>().identifier == Player.PlayerIdentity.PLAYER_1) { { RightWing.transform.localRotation = Quaternion.Euler(minXAngle, 0, 0); LeftWing.transform.localRotation = Quaternion.Euler(minXAngle, 0, 0); } } else { { RightWing.transform.localRotation = Quaternion.Euler(maxXAngle, 0, 0); LeftWing.transform.localRotation = Quaternion.Euler(maxXAngle, 0, 0); } } } if (Gamepad.GetStick_L().X > 0) //GAMEPAD RIGHT { keyDirection.x += 1; if (this.gameObject.GetComponent <Player>().identifier == Player.PlayerIdentity.PLAYER_1) { { RightWing.transform.localRotation = Quaternion.Euler(maxXAngle, 0, 0); LeftWing.transform.localRotation = Quaternion.Euler(maxXAngle, 0, 0); } } else { { RightWing.transform.localRotation = Quaternion.Euler(minXAngle, 0, 0); LeftWing.transform.localRotation = Quaternion.Euler(minXAngle, 0, 0); } } } } #endregion }
void MoveCard() { if (gamepad.GetStick_L().X == 1) { //Get card indexes int cardIndex = cardOrder.IndexOf(selectedCard); int otherCardIndex = cardIndex + 1; if (otherCardIndex == cardOrder.Count) { otherCardIndex = 0; } //Get other card CardBehaviour otherCard = cardOrder[otherCardIndex]; CardBehaviour middleCard = null; if (otherCardIndex == 0) { middleCard = cardOrder[1]; } //Swap card positions selectedCard.Move(new Vector3(otherCard.transform.localPosition.x, selectedCard.offsetY, otherCard.transform.localPosition.z)); if (middleCard != null) { otherCard.Move(new Vector3(middleCard.transform.localPosition.x, middleCard.originY, middleCard.transform.localPosition.z)); middleCard.Move(new Vector3(selectedCard.transform.localPosition.x, selectedCard.originY, selectedCard.transform.localPosition.z)); //Update card order cardOrder[1] = otherCard; cardOrder[otherCardIndex] = selectedCard; cardOrder[cardIndex] = middleCard; } else { otherCard.Move(new Vector3(selectedCard.transform.localPosition.x, selectedCard.originY, selectedCard.transform.localPosition.z)); //Update card order cardOrder[cardIndex] = otherCard; cardOrder[otherCardIndex] = selectedCard; cardOrder[cardIndex].cardIndex = cardIndex; cardOrder[otherCardIndex].cardIndex = otherCardIndex; } //Input cooldown canChangeCards = false; StartCoroutine(HorizontalCooldown(selectedCard.moveTime)); } if (gamepad.GetStick_L().X == -1) { //Get card indexes int cardIndex = cardOrder.IndexOf(selectedCard); int otherCardIndex = cardIndex - 1; if (otherCardIndex < 0) { otherCardIndex = cardOrder.Count - 1; } //Get other card CardBehaviour otherCard = cardOrder[otherCardIndex]; CardBehaviour middleCard = null; if (otherCardIndex == cardOrder.Count - 1) { middleCard = cardOrder[1]; } //Swap card positions selectedCard.Move(new Vector3(otherCard.transform.localPosition.x, selectedCard.offsetY, otherCard.transform.localPosition.z)); if (middleCard != null) { otherCard.Move(new Vector3(middleCard.transform.localPosition.x, middleCard.originY, middleCard.transform.localPosition.z)); middleCard.Move(new Vector3(selectedCard.transform.localPosition.x, selectedCard.originY, selectedCard.transform.localPosition.z)); //Update card order cardOrder[1] = otherCard; cardOrder[otherCardIndex] = selectedCard; cardOrder[cardIndex] = middleCard; } else { otherCard.Move(new Vector3(selectedCard.transform.localPosition.x, selectedCard.originY, selectedCard.transform.localPosition.z)); //Update card order cardOrder[cardIndex] = otherCard; cardOrder[otherCardIndex] = selectedCard; cardOrder[cardIndex].cardIndex = cardIndex; cardOrder[otherCardIndex].cardIndex = otherCardIndex; } //Input cooldown canChangeCards = false; StartCoroutine(HorizontalCooldown(selectedCard.moveTime)); } }