示例#1
0
 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);
 }
示例#2
0
 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();
     }
 }
示例#3
0
 public TimeCachedValue(TimeCachedValue <T> rhs)
 {
     m_value        = rhs.m_value;
     m_last_updated = rhs.m_last_updated;
     m_valid        = rhs.m_valid;
 }