|
|
|
|
|
|
private float _verticalMovement; |
|
|
|
private float _gravityContributionMultiplier; |
|
|
|
private float _initialJumpForce; |
|
|
|
private const float GRAVITY_COMEBACK_MULTIPLIER = 15f; |
|
|
|
private const float GRAVITY_COMEBACK_MULTIPLIER = .03f; |
|
|
|
private const float GRAVITY_DIVIDER = .6f; |
|
|
|
private const float GRAVITY_MULTIPLIER = 5f; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void OnUpdate() |
|
|
|
{ |
|
|
|
_gravityContributionMultiplier += Time.deltaTime * GRAVITY_COMEBACK_MULTIPLIER; |
|
|
|
_gravityContributionMultiplier += GRAVITY_COMEBACK_MULTIPLIER; |
|
|
|
_gravityContributionMultiplier *= GRAVITY_DIVIDER; //Reduce the gravity effect
|
|
|
|
_verticalMovement += Physics.gravity.y * GRAVITY_MULTIPLIER * Time.deltaTime * _gravityContributionMultiplier; |
|
|
|
//Note that even if it's added, the above value is negative due to Physics.gravity.y
|
|
|
|