private void Update()
if (IsClimbable)
{
float verticalInput = Input.GetAxisRaw("Vertical");
float horizontalInput = Input.GetAxisRaw("Horizontal");
if (verticalInput > 0)
{
if (Input.GetKey(KeyCode.LeftShift))
{
Player.velocity = new Vector2(Player.velocity.x, climbSprint);
}
else
{
Player.velocity = new Vector2(Player.velocity.x, climb);
}
IsClimbing = true;
}
else if (verticalInput < 0)
{
Player.velocity = new Vector2 (Player.velocity.x, -climb);
IsClimbing = true;
}
else
{
Player.velocity = new Vector2 (0f, 0f);
IsClimbing = true;
}
if (IsClimbing && IsClimbable && verticalInput == 0f && horizontalInput == 0f)
{
Player.velocity = new Vector2 (Player.velocity.x, 0f);
Physics2D.gravity = new Vector2 (Player.velocity.x, 0f);
}
else if (IsClimbing || IsClimbable || (verticalInput !=0f) || (horizontalInput !=0f))
{
Physics2D.gravity = new Vector2 (0, -9.81f);
}
}