void Update() { // check for Y kill if (!isDead && transform.position.y < killHeight) { m_Health.Kill(); } hasJumpedThisFrame = false; bool wasGrounded = isGrounded; GroundCheck(); // landing if (isGrounded && !wasGrounded) { // Fall damage float fallSpeed = -Mathf.Min(characterVelocity.y, m_LatestImpactSpeed.y); float fallSpeedRatio = (fallSpeed - minSpeedForFallDamage) / (maxSpeedForFallDamage - minSpeedForFallDamage); if (recievesFallDamage && fallSpeedRatio > 0f) { float dmgFromFall = Mathf.Lerp(fallDamageAtMinSpeed, fallDamageAtMaxSpeed, fallSpeedRatio); m_Health.TakeDamage(dmgFromFall, null); // fall damage SFX audioSource.PlayOneShot(fallDamageSFX); } else { // land SFX audioSource.PlayOneShot(landSFX); } } // crouching if (_mPlayerInputHandler.GetCrouchedInputDown()) { SetCrouchingState(!isCrouching, false); } UpdateCharacterHeight(false); HandleCharacterMovement(); }