void Update() { if (!GameManager.instance.IsGamePaused) { CheckHealth(); CheckStamina(); StaminaRecovery(); if (!Stunned) { PlayerActions(); } if (RB.velocity.y < -2f) { characterAnim.SetBool("IsFalling", true); characterAnim.SetBool("IsJumping", false); } else { characterAnim.SetBool("IsFalling", false); } if (grapplingHook.gameObject.GetComponent <Rigidbody2D>().isKinematic&& RB.velocity.y > 4f) { characterAnim.SetBool("IsJumping", true); } if (grapplingHook.gameObject.activeSelf && Vector2.Distance(transform.position, grapplingHook.transform.position) < 2f && grapplingHook.GetComponent <Rigidbody2D>().isKinematic) { movementEnabled = false; RB.velocity = Vector2.zero; xMovement = 0; characterAnim.SetFloat("Speed", Mathf.Abs(xMovement)); if (grapplingHook.transform.position.x > transform.position.x) { transform.rotation = new Quaternion(transform.rotation.x, 0, 0, 0); xMovementDirection = Vector2.right; } else { transform.rotation = new Quaternion(transform.rotation.x, 180, 0, 0); xMovementDirection = Vector2.left; } if (!IsGrounded()) { characterAnim.SetBool("IsGrappled", true); } } else { movementEnabled = true; characterAnim.SetBool("IsGrappled", false); } if (Experience >= NextLevelExperience) { LevelUp(); OnLevelUpCallback.Invoke(); } } }