private IEnumerator DecrementWaterLevel() { float amountBailed = 0; while (bailAmount > amountBailed) { float bailThisCall = Mathf.Clamp(bailAmount * Time.deltaTime, 0, bailAmount - amountBailed); GlobalValues.IncrementWaterLevel(-bailThisCall); amountBailed += bailThisCall; yield return(null); } yield return(null); }
void Update() { float floodThisFrame = GlobalValues.leakRate * Time.deltaTime; if (floodAmount > 0) { floodThisFrame += PartialFlood(); } GlobalValues.IncrementWaterLevel(floodThisFrame); if (boolInput && bucketAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1 && !bucketAnimator.IsInTransition(0) && GlobalValues.waterLevel > 5f) { BailWater(); } else { boolInput = false; } }