private void UpdateEnergy() { if (this.m_Player.m_DreamActive) { return; } float deltaTime = Time.deltaTime; FPPController fppcontroller = this.m_Player.m_FPPController; if (!fppcontroller) { return; } DeathController deathController = this.m_Player.m_DeathController; if (deathController.IsActive()) { return; } ConsciousnessController component = this.m_Player.GetComponent <ConsciousnessController>(); if (component.IsActive()) { return; } if (!Cheats.m_GodMode && !this.m_LossParametersBlocked) { this.m_Energy -= this.m_EnergyConsumptionPerSecond * deltaTime; if (this.IsNutritionCarboCriticalLevel() || this.IsNutritionFatCriticalLevel() || this.IsNutritionProteinsCriticalLevel()) { this.m_Energy -= this.m_EnergyConsumptionPerSecondNoNutrition * deltaTime; } if (this.m_DiseasesModule.GetDisease(ConsumeEffect.Fever).IsActive()) { this.m_Energy -= this.m_EnergyConsumptionPerSecondFever * deltaTime; } if (this.m_DiseasesModule.GetDisease(ConsumeEffect.FoodPoisoning).IsActive()) { this.m_Energy -= this.m_EnergyConsumptionPerSecondFoodPoison * deltaTime; } } this.m_Energy = Mathf.Clamp(this.m_Energy, 0f, this.m_MaxEnergy); if (this.m_Energy <= PlayerSanityModule.Get().m_LowEnegryWhispersLevel) { PlayerSanityModule.Get().OnWhispersEvent(PlayerSanityModule.WhisperType.LowEnergy); } }
private void UpdateHP() { if (this.m_Player.m_DreamActive) { return; } float deltaTime = Time.deltaTime; FPPController fppcontroller = this.m_Player.m_FPPController; if (!fppcontroller) { return; } DeathController deathController = this.m_Player.m_DeathController; if (deathController.IsActive()) { return; } ConsciousnessController component = this.m_Player.GetComponent <ConsciousnessController>(); if (component.IsActive()) { return; } if (!Cheats.m_GodMode) { if (this.IsNutritionCarboCriticalLevel() || this.IsNutritionFatCriticalLevel() || this.IsNutritionProteinsCriticalLevel()) { this.IncreaseHP(-this.m_HealthLossPerSecondNoNutrition * deltaTime); } if (this.IsHydrationCriticalLevel()) { this.IncreaseHP(-this.m_HealthLossPerSecondNoHydration * deltaTime); } bool flag = true; List <Injury> injuriesList = this.m_InjuryModule.GetInjuriesList(); for (int i = 0; i < injuriesList.Count; i++) { if (injuriesList[i].m_ParentInjury == null) { if (injuriesList[i].m_Type != InjuryType.Worm && injuriesList[i].m_Type != InjuryType.Rash && injuriesList[i].m_Type != InjuryType.Leech) { flag = false; break; } } } if (flag) { float num = MainLevel.Instance.m_TODTime.m_DayLengthInMinutes + MainLevel.Instance.m_TODTime.m_NightLengthInMinutes; float num2 = num * 60f; this.IncreaseHP(this.m_MaxHP * this.m_HealthRecoveryPerDay / num2 * deltaTime); } if (this.m_Oxygen <= 0f) { this.IncreaseHP(-this.m_HealthLossPerSecondNoOxygen * deltaTime); } } this.m_HP = Mathf.Clamp(this.m_HP, 0f, this.m_MaxHP); if (this.m_HP < 10f) { if (!this.m_AudioModule.IsHeartBeatSoundPlaying()) { this.m_AudioModule.PlayHeartBeatSound(1f, true); } } else if (this.m_AudioModule.IsHeartBeatSoundPlaying()) { this.m_AudioModule.StopHeartBeatSound(); } }