3 [
Attribute(
"BloodUnconsciousBar",
desc:
"Image that shows when Character becomes conscious")]
4 protected string m_sUnconsciousBarName;
6 [
Attribute(
"BloodUnconsciousBarTop",
desc:
"Set at the end of the bar")]
7 protected string m_sUnconsciousBarTopName;
9 [
Attribute(
"BloodUnconsciousFillRight",
desc:
"Filler make sure the bar is set the correct size")]
10 protected string m_sUnconsciousFillerRightName;
13 protected float m_iUnconsciousBarTopSize;
15 protected float m_fUnconsciousLevel;
17 protected Widget m_UnconsciousBar;
18 protected Widget m_UnconsciousBarTop;
19 protected Widget m_UnconsciousFillerRight;
23 m_UnconsciousBar = w.FindAnyWidget(m_sUnconsciousBarName);
24 m_UnconsciousBarTop = w.FindAnyWidget(m_sUnconsciousBarTopName);
25 m_UnconsciousFillerRight = w.FindAnyWidget(m_sUnconsciousFillerRightName);
27 LayoutSlot.SetFillWeight(m_UnconsciousBarTop, m_iUnconsciousBarTopSize);
29 if (!m_UnconsciousBar || !m_UnconsciousFillerRight || !m_UnconsciousBarTop)
36 vector bloodData = var.GetVector();
38 m_fUnconsciousLevel = bloodData[1] * 100;
40 super.Init(w, attribute);
47 float GetUnconsciousLevel()
49 return m_fUnconsciousLevel;
54 super.SetSliderSettings(var, sliderData);
61 super.SetVariableToDefaultValue(var);
67 super.SetFromVar(var);
71 override bool OnChange(Widget w,
int x,
int y,
bool finished)
73 super.OnChange(w, x, y, finished);
78 protected void UpdateBloodSlider()
80 float value = m_SliderWidgetComponent.GetValue();
82 if (value >= m_fUnconsciousLevel)
84 m_UnconsciousBarTop.SetVisible(
true);
85 LayoutSlot.SetFillWeight(m_UnconsciousBar, Math.Clamp(m_fUnconsciousLevel - m_iUnconsciousBarTopSize, 0, 100));
86 LayoutSlot.SetFillWeight(m_UnconsciousFillerRight, Math.Clamp(100 - m_fUnconsciousLevel, 0, 100));
90 if (value >= m_iUnconsciousBarTopSize)
92 m_UnconsciousBarTop.SetVisible(
true);
93 LayoutSlot.SetFillWeight(m_UnconsciousBar, Math.Clamp(value - m_iUnconsciousBarTopSize, 0 , 100));
94 LayoutSlot.SetFillWeight(m_UnconsciousFillerRight, Math.Clamp(100 - value, 0, 100));
98 m_UnconsciousBarTop.SetVisible(
false);
99 LayoutSlot.SetFillWeight(m_UnconsciousBar, Math.Clamp(value, 0 , 100));
100 LayoutSlot.SetFillWeight(m_UnconsciousFillerRight, Math.Clamp(100 - value, 0, 100));