public IEnumerator <float> GradualUse() { float t = 0; float GetProgress() => (t += GameTime.Time.deltaTime) / UsageTime; void ApplyGradualBonusGains() { Stats.Status(Type.Hunger).Add((Stats.Status(Type.Hunger).MaxAmount *HungerPercentBonus) / UsageTime * Time.deltaTime); Stats.Status(Type.Energy).Add((Stats.Status(Type.Energy).MaxAmount *EnergyPercentBonus) / UsageTime * Time.deltaTime); Stats.Status(Type.Health).Add((Stats.Status(Type.Health).MaxAmount *HealthPercentBonus) / UsageTime * Time.deltaTime); Stats.Status(Type.Mood).Add((Stats.Status(Type.Mood).MaxAmount *MoodPercentBonus) / UsageTime * Time.deltaTime); Stats.Status(Type.Thirst).Add((Stats.Status(Type.Thirst).MaxAmount *ThirstPercentBonus) / UsageTime * Time.deltaTime); } void ApplyGradualStatGains() { Stats.Status(Type.Hunger).Add((Hunger / UsageTime) * Time.deltaTime); Stats.Status(Type.Energy).Add((Energy / UsageTime) * Time.deltaTime); Stats.Status(Type.Health).Add((Health / UsageTime) * Time.deltaTime); Stats.Status(Type.Mood).Add((Mood / UsageTime) * Time.deltaTime); Stats.Status(Type.Thirst).Add((Thirst / UsageTime) * Time.deltaTime); Stats.Status(Type.Bladder).Add((Bladder / UsageTime) * Time.deltaTime); } while (GetProgress() < 1 && !cancel) { ApplyGradualBonusGains(); ApplyGradualStatGains(); yield return(0f); } PlayerBuff.GetRandomBuff(); yield return(0f); }