This commit is contained in:
allylikesfrogs
2023-05-05 19:54:18 -07:00
parent bcec1cf489
commit b3ab81f7eb
5 changed files with 34 additions and 17 deletions

View File

@@ -39,6 +39,8 @@ public class PlayerMovement : MonoBehaviour
GameObject trumpetAnimationObject;
bool trumpetActive = false;
//clarinet
private float tempFallSpeed;
//Jump
private bool _isJumpCut;
@@ -91,6 +93,7 @@ public class PlayerMovement : MonoBehaviour
{
SetGravityScale(Data.gravityScale);
IsFacingRight = true;
tempFallSpeed = Data.maxFallSpeed;
}
void OnMove(InputValue value)
@@ -313,10 +316,6 @@ public class PlayerMovement : MonoBehaviour
//Caps maximum fall speed, so when falling over large distances we don't accelerate to insanely high speeds
RB.velocity = new Vector2(RB.velocity.x, Mathf.Max(RB.velocity.y, -Data.maxFallSpeed));
}
/*else if (playerBehavior.isInWater)
{
SetGravityScale(0);
}*/
else
{
//Default gravity if standing on a platform or moving upwards
@@ -563,6 +562,16 @@ public class PlayerMovement : MonoBehaviour
// print(Physics2D.OverlapBox(this.transform.position, _groundCheckSize, 0, _groundLayer) && !IsJumping);
return (Physics2D.OverlapBox(new Vector2(this.transform.position.x, this.transform.position.y - _groundCheckOffset), _groundCheckSize, 0, _groundLayer) && !IsJumping);
}
public void FloatGravity()
{
Data.maxFallSpeed = 0.1f;
}
public void EndFloatGravity()
{
Data.maxFallSpeed = tempFallSpeed;
}
#endregion