private void FixedUpdate() { ForceX = Mathf.Abs(ForceX) < 4 ? 0 : Mathf.Sign(ForceX) * (Mathf.Abs(ForceX) - gravityScale * windFriction / 2); ForceY = Mathf.Abs(ForceY) < 4 ? 0 : Mathf.Sign(ForceY) * (Mathf.Abs(ForceY) - gravityScale * windFriction); grounded = Physics2D.OverlapCapsule(groundCheck.position, new Vector2(0.5f, 1.5f), CapsuleDirection2D.Vertical, 0, whatIsGround); bool IsSlope = Physics2D.OverlapCapsule(groundCheck.position, new Vector2(0.5f, 1.5f), CapsuleDirection2D.Vertical, 0, whatIsSlope); animator.SetBool("IsSlope", IsSlope); if (playerAction == PlayerAction.ClimbingUp) { rgdb.velocity = new Vector2(ClimbingVelocityX, ClimbingVelocityY); } else if (playerAction == PlayerAction.HangUp) { rgdb.velocity = new Vector2(ForceX, move.y * ropeSpeed); } else { rgdb.velocity = new Vector2(move.x * maxSpeed + ForceX, rgdb.velocity.y + ForceY); } //If it is hanged on the rope and has no energy, the player falls if (energyController.GetCurrentEnergy() <= energyController.GetEnergyRecoverySpeed()) { animator.Play("Falling"); playerAction = PlayerAction.Falling; setNeutralState(); } }