//FunciĆ³n que hace que el player se mueva y salte con las ArrowKeys public void JumpAndMoveCharacter() { if (cController.isGrounded) { dirPos = transform.forward * Input.GetAxis("Vertical") + transform.right * Input.GetAxis("Horizontal"); if (Input.GetKeyDown(KeyCode.Space)) { if ((isRunning || isWalking) && cController.velocity.magnitude == 0) { isRunning = false; isWalking = false; soundsManager.StopSound(); } dirPos.y = jumpForce; soundsManager.ManageJumpSound(); } } dirPos.y += gravity * Time.deltaTime; cController.Move(dirPos * moveSpeed * Time.deltaTime); }
public void CharacterVelocity() { if (playerController.HasCallTheMount() && !hasSnorted) { playerSoundsManager.ManageMountRoar(); hasSnorted = true; } if (!isWalking && cController.velocity.magnitude != 0 && cController.isGrounded) { isWalking = true; playerSoundsManager.ManageMountSound(); } //Cuando pasa de estar andando a estar completamente quieto else if (cController.velocity.magnitude == 0 && isWalking) { isWalking = false; playerSoundsManager.StopSound(); } }