void Update() { float x = Input.GetAxisRaw("Horizontal"); Vector3 input = new Vector3(x, 0, 0); bool running = Input.GetKey(KeyCode.LeftShift); if (x < 0) { ScaleSwap(-1); } else if (x > 0) { ScaleSwap(1); } if (Mathf.Abs(x) > 0) { if (running) { playerAnimator.WalkingAnimation(false); playerAnimator.Running(true); } else { playerAnimator.WalkingAnimation(true); playerAnimator.Running(false); } } else { playerAnimator.WalkingAnimation(false); playerAnimator.Running(false); } float targetSpeed = ((running) ? runSpeed + appleManager.charachterAppleLossBoost() : startSpeed + appleManager.charachterAppleLossBoost()) * input.magnitude; currentSpeed = Mathf.SmoothDamp(currentSpeed, targetSpeed, ref speedSmoothVelocity, 0.3f); force = input * currentSpeed; }