private void FixedUpdate()
{
canBreathe.Value = airIsBreathable;
if (canBreathe == true)
{
holdBreathTimer = 0f;
reserve.Value = 1f;
}
else
{
if (maxHoldBreathTime <= 0f)
{
reserve.Value = 0f;
}
else
{
reserve.Value = 1f - holdBreathTimer / maxHoldBreathTime;
}
if (holdBreathTimer > maxHoldBreathTime)
{
holdBreathTimer = maxHoldBreathTime;
suffocate.Trigger();
}
else
{
holdBreathTimer += Time.fixedDeltaTime;
}
}
airIsBreathable = false;
}