Exemple #1
0
 public void UpdateAmmoMeter(float ammoLevel)
 {
     if (BDArmorySettings.SHOW_AMMO_GAUGES && !BDArmorySettings.INFINITE_AMMO)
     {
         if (ammoLevel > 0)
         {
             if (emptyGauge != null)
             {
                 ForceRedraw();
             }
             if (ammoGauge == null)
             {
                 ammoGauge = InitAmmoGauge(AmmoName);
             }
             ammoGauge?.SetValue(ammoLevel, 0, 1);
         }
         else
         {
             if (ammoGauge != null)
             {
                 ForceRedraw();
             }
             if (emptyGauge == null)
             {
                 emptyGauge = InitEmptyGauge();
                 emptyGauge?.SetValue(1, 0, 1);
             }
         }
     }
     else if (ammoGauge != null || emptyGauge != null)
     {
         ForceRedraw();
     }
 }
Exemple #2
0
        protected void UpdateOverheatBox(double val, double minVal)
        {
            if (!vessel.isActiveVessel)
            {
                overheatBox = null;
                return;
            }

            if (val >= (minVal - 0.00001d))
            {
                if (overheatBox == null)
                {
                    overheatBox = part.stackIcon.DisplayInfo();
                    overheatBox.SetMsgBgColor(XKCDColors.DarkRed.A(0.6f));
                    overheatBox.SetMsgTextColor(XKCDColors.OrangeYellow.A(0.6f));
                    overheatBox.SetMessage("Eng. Int.");
                    overheatBox.SetProgressBarBgColor(XKCDColors.DarkRed.A(0.6f));
                    overheatBox.SetProgressBarColor(XKCDColors.OrangeYellow.A(0.6f));
                }
                double scalar   = 1d / (1d - minVal);
                double scaleFac = 1f - scalar;
                float  gaugeMin = (float)(scalar * minVal + scaleFac);
                overheatBox.SetValue(Mathf.Clamp01((float)(val * scalar + scaleFac)), gaugeMin, 1.0f);
            }
            else
            {
                if (overheatBox != null)
                {
                    part.stackIcon.RemoveInfo(overheatBox);
                    overheatBox = null;
                }
            }
        }
Exemple #3
0
 /// <param name="heatLevel">0 is no heat, 1 is max heat</param>
 public void UpdateHeatMeter(float heatLevel)
 {
     //heat
     if (heatLevel > (1f / 3))
     {
         if (heatGauge == null)
         {
             heatGauge = InitHeatGauge();
         }
         heatGauge?.SetValue((heatLevel * 3 - 1) / 2, 0, 1);    //null check
     }
     else if (heatGauge != null && heatLevel < 0.25f)
     {
         ForceRedraw();
     }
 }
Exemple #4
0
 /// <param name="reloadProgress">0 is just fired, 1 is just reloaded</param>
 public void UpdateReloadMeter(float reloadRemaining)
 {
     if (reloadRemaining < 1)
     {
         if (reloadBar == null)
         {
             reloadBar = InitReloadBar();
             if (ReloadAudioClip)
             {
                 AudioSource.PlayOneShot(ReloadAudioClip);
             }
         }
         reloadBar?.SetValue(reloadRemaining, 0, 1);
     }
     else if (reloadBar != null)
     {
         ForceRedraw();
         if (ReloadCompleteAudioClip)
         {
             AudioSource.PlayOneShot(ReloadCompleteAudioClip);
         }
     }
 }