public override void MoveController(Vector2 finalPlayerVelocity, bool isOnPlatform = false) { playerCollision.ManageObjectCollisions(ref finalPlayerVelocity, playerInputDirection); transform.Translate(finalPlayerVelocity); playerAnimation.SetFloat("moveSpeed", finalPlayerVelocity.x * playerMovementTargetSpeed); if (isOnPlatform) { playerCollision.collisionData.isCollidingBelow = true; } }
private void CalculatePlayerVelocity(Vector2 rawInput) { if (canPlayerMove) { playerMovementTargetSpeed = ReturnPlayerTargetSpeed(rawInput); playerVelocity.x = Mathf.SmoothDamp(playerVelocity.x, playerMovementTargetSpeed, ref playerMovementSmoothVelocity, ReturnPlayerSmoothMovementTime()); playerVelocity.y += playerGravity * Time.deltaTime; playerAnimation.SetFloat("moveSpeed", Mathf.Abs(playerVelocity.x)); } }