void Update() { horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed; if (Input.GetButtonDown("Jump")) { jump = true; } if (Input.GetButtonDown("Crouch")) { crouch = true; } if (Input.GetButtonUp("Crouch")) { crouch = false; } if (Input.GetKeyDown(KeyCode.P)) { ui.ToggleWindow(); } controller.Move(horizontalMove * Time.fixedDeltaTime, crouch, jump); jump = false; }
void FixedUpdate() { controller.Move(horizontalMove * Time.fixedDeltaTime, jump); //check to see which way the character is moving if (horizontalMove > 0 && !m_FacingRight) { Flip(); } else if (horizontalMove < 0 && m_FacingRight) { Flip(); } animator.SetBool("Running", Mathf.Abs(horizontalMove) > 0); //animator.SetFloat("Horizontal", Mathf.Abs(horizontalMove)); //Debug.Log(Input.GetAxis("Horizontal")); jump = false; }
private void FixedUpdate() { charController.Move(horizontalMove * Time.fixedDeltaTime, false); }