/// <summary> /// sets notches on the hud according to where the thresholds are /// </summary> /// <param name="hudElement"></param> /// <param name="uIBarData"></param> private static void SetHudMarkingState(ChargeBarUIID hudElement, UIBarData uIBarData) { for (int markingID = 0; markingID < hudElement.Markings.Count; markingID++) { if (markingID >= uIBarData.TreshHolds.Count) { hudElement.Markings[markingID].SetActive(false); } } }
private void UpdateChargeBars(UIBarData chargebarData) { float value = chargebarData.Node.Value; float cap = chargebarData.Capacity.Value; chargebarData.HudData.ChargeBar.ProgressPercentage = value * 100f / cap; for (int i = 0; i < Math.Min(3, chargebarData.TreshHolds.Count); i++) { var treshHoldPlacementRatio = chargebarData.TreshHolds[i].Value / cap; GameObject marker = chargebarData.HudData.Markings[i]; var newpos = marker.transform.position; newpos.x = _hudData.ChargebarsXBounds.x + (_hudData.ChargebarsXBounds.y - _hudData.ChargebarsXBounds.x) * treshHoldPlacementRatio; marker.transform.position = newpos; } }