// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.LeftShift)) { moveSpeed = fastSpeed; } else { moveSpeed = normalSpeed; } //moveDirection = new Vector3(moveSpeed * Input.GetAxis("Horizontal"), moveDirection.y, moveSpeed * Input.GetAxis("Vertical")); float yStore = moveDirection.y; moveDirection = (transform.forward * Input.GetAxis("Vertical") * moveSpeed) + (transform.right * Input.GetAxis("Horizontal") * moveSpeed); moveDirection = moveDirection.normalized * moveSpeed; moveDirection.y = yStore; if (controller.isGrounded) { if (Input.GetButtonDown("Jump")) { moveDirection.y = jumpForce; } } moveDirection.y = moveDirection.y + (Physics.gravity.y * gravityScale * Time.deltaTime); controller.Move(moveDirection * Time.deltaTime); if (Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0) { transform.rotation = Quaternion.Euler(0f, pivot.transform.eulerAngles.y, 0f); Quaternion newRotation = Quaternion.LookRotation(new Vector3(moveDirection.x, 0f, moveDirection.z)); playerModel.transform.rotation = Quaternion.Slerp(playerModel.transform.rotation, newRotation, moveSpeed * Time.deltaTime); } if (canCatch && Input.GetKeyDown(KeyCode.F)) { Caught(); textController.CloseMessagePanel(); } if (!isAlive) { losePanel.OpenMessagePanel(); Time.timeScale = 0; if (Input.anyKeyDown) { SceneManager.LoadScene("SampleScene"); losePanel.CloseMessagePanel(); Time.timeScale = 1; } } }