public void UpdateHud(float dt, float energyLowPulse) { //if (energyBar.GetCalculateMode() != calculateMode) // energyBar.SetCalulateMode(calculateMode); if (cEnergyWarning) { if (energyLow) { energyLowFader = Mathf.Min(energyLowFader + 2f * dt, 1f); Color color = Color.white; color.a = energyLowFader * energyLowPulse; cEnergyWarning.material.color = color; combatEnergyWarning.material.color = color; ballEnergyWarning.material.color = color; } else { energyLowFader = Mathf.Max(0f, energyLowFader - 2f * dt); Color color = Color.white; color.a = energyLowFader * energyLowPulse; cEnergyWarning.material.color = color; combatEnergyWarning.material.color = color; ballEnergyWarning.material.color = color; } if (cEnergyWarning.material.color.a > 0f) { cEnergyWarning.enabled = true; combatEnergyWarning.enabled = true; ballEnergyWarning.enabled = true; } else { cEnergyWarning.enabled = false; combatEnergyWarning.enabled = false; ballEnergyWarning.enabled = false; } } if (cEnergyBar.GetFilledEnergy() != cachedBarEnergy || barDirty) { barDirty = false; cachedBarEnergy = cEnergyBar.GetFilledEnergy(); string lString = ((int)fmod(cachedBarEnergy, 101f)).ToString("d2"); cEnergyDigits.text = lString; combatEnergyDigits.text = lString; ballEnergyDigits.text = lString; } //hudChangingColors.hudColors.EnergyBarColors barColors = hudColors.getVisorEnergyBarColors(); Color emptyColor = energyLow ? hudColors.energyBarEmptyLow : barColors.empty; Color filledColor = energyLow ? hudColors.energyBarFilledLow : barColors.filled; Color shadowColor = energyLow ? hudColors.energyBarShadowLow : barColors.shadow; Color useFillColor = Color.Lerp(filledColor, hudColors.energyBarFlashColor, flashMag); if (energyLow) { useFillColor = Color.Lerp(useFillColor, new Color(1f, 0.8f, 0.4f, 1f), energyLowPulse); } cEnergyBar.SetFilledColor(useFillColor); cEnergyBar.SetShadowColor(shadowColor); cEnergyBar.SetEmptyColor(emptyColor); updateEnergyBarColors(useFillColor, shadowColor, emptyColor); cEnergyBar.updateBar(dt); //if (calculateMode == hudEnergyBar.CalculateMode.manual) //{ // energyBar.SetBarPercentage(healthP); //} cEnergyBar.Draw(); }