private void FixedUpdate() { if (!IsLeftJoystickInput()) { animationController.ChangeAnimation(PlayerAnimationController.ANIMATION_IDLE); } else { transform.position += isometricForward * Time.deltaTime * moveSpeed * Input.GetAxis(leftStickHorizontal); transform.position += isometricRight * Time.deltaTime * moveSpeed * Input.GetAxis(leftStickVertical); animationController.ChangeAnimation(PlayerAnimationController.ANIMATION_RUN); } if (IsRightJoystickInput()) { float angle = (Mathf.Atan2(Input.GetAxis(rightStickHorizontal), Input.GetAxis(rightStickVertical)) * Mathf.Rad2Deg) + rotationOffset; transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(new Vector3(0f, -angle, 0)), rotationSpeed * Time.deltaTime); } }
void Update() { // Gives a value between -1 and 1 horizontal = Input.GetAxisRaw("Horizontal"); // -1 is left vertical = Input.GetAxisRaw("Vertical"); // -1 is down if (Input.GetKeyDown(KeyCode.Space)) { playerAnimationController.ChangeAnimation("isSlashing"); } }