protected override void VehicleFixedUpdate() { base.VehicleFixedUpdate(); if (fixedDragUpdate == null) { fixedDragUpdate = new TimeCachedValue <float> { refreshCooldown = 0.5f, refreshRandomRange = 0.2f, updateValue = CalculateDesiredDrag }; } rigidBody.drag = fixedDragUpdate.Get(false); }
public void CalculateQualities(bool firstTime, bool forceArtificialLightUpdates = false, bool forceArtificialTemperatureUpdates = false) { if (!IsDead()) { if (sunExposure == null) { sunExposure = new TimeCachedValue <float> { refreshCooldown = 30f, refreshRandomRange = 5f, updateValue = SunRaycast }; } if (artificialLightExposure == null) { artificialLightExposure = new TimeCachedValue <float> { refreshCooldown = 60f, refreshRandomRange = 5f, updateValue = CalculateArtificialLightExposure }; } if (artificialTemperatureExposure == null) { artificialTemperatureExposure = new TimeCachedValue <float> { refreshCooldown = 60f, refreshRandomRange = 5f, updateValue = CalculateArtificialTemperature }; } if (forceArtificialTemperatureUpdates) { artificialTemperatureExposure.ForceNextRun(); } CalculateLightQuality(forceArtificialLightUpdates || firstTime); CalculateWaterQuality(); CalculateWaterConsumption(); CalculateGroundQuality(firstTime); CalculateTemperatureQuality(); CalculateOverallQuality(); } }
public TimeCachedValue(TimeCachedValue <T> rhs) { m_value = rhs.m_value; m_last_updated = rhs.m_last_updated; m_valid = rhs.m_valid; }