6 [
Attribute(
"BloodUnconsciousBar",
desc:
"Image that shows when Character becomes conscious")]
7 protected string m_sUnconsciousBarName;
9 [
Attribute(
"BloodUnconsciousBarTop",
desc:
"Set at the end of the bar")]
10 protected string m_sUnconsciousBarTopName;
12 [
Attribute(
"BloodUnconsciousFillRight",
desc:
"Filler make sure the bar is set the correct size")]
13 protected string m_sUnconsciousFillerRightName;
16 protected float m_iUnconsciousBarTopSize;
18 protected float m_fBloodLevelLoseDeath;
19 protected float m_fBloodLevelContiousness;
20 protected float m_fBloodLevel;
22 protected Widget m_UnconsciousBar;
23 protected Widget m_UnconsciousBarTop;
24 protected Widget m_UnconsciousFillerRight;
27 override bool NeedUpdate()
29 return m_CharacterDamageManager !=
null;
35 super.UpdateDetail(entity);
37 HitZone bloodHitZone = m_CharacterDamageManager.GetBloodHitZone();
42 if (m_CharacterDamageManager.GetState() ==
EDamageState.DESTROYED)
46 m_UnconsciousBar.SetVisible(
false);
48 if (m_UnconsciousBarTop)
49 m_UnconsciousBarTop.SetVisible(
false);
51 if (m_UnconsciousFillerRight)
52 m_UnconsciousFillerRight.SetVisible(
false);
54 SetBarAndPercentageValue(0);
58 float bloodLevel = Math.InverseLerp(bloodHitZone.GetDamageStateThreshold(
ECharacterBloodState.DESTROYED), 1, bloodHitZone.GetHealthScaled());
61 bloodLevel = Math.Clamp(bloodLevel, 0, 1);
62 UpdateBloodBar(bloodLevel, bloodHitZone.GetDamageStateThreshold(
ECharacterBloodState.UNCONSCIOUS));
63 SetBarAndPercentageValue(bloodLevel);
67 protected void UpdateBloodBar(
float bloodLevel,
float unconsciousLevel)
69 if (bloodLevel >= unconsciousLevel)
71 m_UnconsciousBarTop.SetVisible(
true);
72 LayoutSlot.SetFillWeight(m_UnconsciousBar, Math.Clamp(unconsciousLevel - m_iUnconsciousBarTopSize, 0, 1));
73 LayoutSlot.SetFillWeight(m_UnconsciousFillerRight, Math.Clamp(1 - unconsciousLevel, 0, 1));
77 if (bloodLevel >= m_iUnconsciousBarTopSize)
79 m_UnconsciousBarTop.SetVisible(
true);
80 LayoutSlot.SetFillWeight(m_UnconsciousBar, Math.Clamp(bloodLevel - m_iUnconsciousBarTopSize, 0 , 1));
81 LayoutSlot.SetFillWeight(m_UnconsciousFillerRight, Math.Clamp(1 - bloodLevel, 0, 1));
85 m_UnconsciousBarTop.SetVisible(
false);
86 LayoutSlot.SetFillWeight(m_UnconsciousBar, Math.Clamp(bloodLevel, 0 , 1));
87 LayoutSlot.SetFillWeight(m_UnconsciousFillerRight, Math.Clamp(1 - bloodLevel, 0, 1));
93 override void SetBarColor(
bool SetConditionColor)
95 super.SetBarColor(SetConditionColor);
97 if (!m_UnconsciousBar || !m_UnconsciousBarTop)
103 m_UnconsciousBar.SetColor(m_cDefaultBarColor);
104 m_UnconsciousBarTop.SetColor(m_cDefaultBarColor);
108 m_UnconsciousBar.SetColor(m_cHasDpsBarColor);
109 m_UnconsciousBarTop.SetColor(m_cHasDpsBarColor);
116 if (!super.InitDetail(entity, widget))
120 if (!m_CharacterDamageManager)
123 HitZone bloodHitZone = m_CharacterDamageManager.GetBloodHitZone();
127 m_UnconsciousBarTop = widget.FindAnyWidget(m_sUnconsciousBarTopName);
128 m_UnconsciousBar = widget.FindAnyWidget(m_sUnconsciousBarName);
129 m_UnconsciousFillerRight = widget.FindAnyWidget(m_sUnconsciousFillerRightName);
131 if (!m_UnconsciousBarTop || !m_UnconsciousBar || !m_UnconsciousFillerRight)
133 Print(
"'SCR_BloodTooltipDetail' is missing UI to display which means it will be hidden!", LogLevel.ERROR);
137 if (m_CharacterDamageManager.GetState() ==
EDamageState.DESTROYED)
140 if (m_CharacterDamageManager.GetState() ==
EDamageState.DESTROYED)
142 m_UnconsciousBar.SetVisible(
false);
143 m_UnconsciousBarTop.SetVisible(
false);
144 m_UnconsciousFillerRight.SetVisible(
false);
148 LayoutSlot.SetFillWeight(m_UnconsciousBarTop, m_iUnconsciousBarTopSize);
150 UpdateDetail(entity);