9 [
Attribute(
"1", UIWidgets.ComboBox,
"Should comparison be done using percentage of ammo?",
"" )]
10 private bool m_bComparePercentage;
12 [
Attribute(
"2", UIWidgets.EditBox,
"Percentages are 0-100, non-percentage values are rounded to integers",
"")]
13 private float m_fValue;
23 BaseMagazineComponent magazine =
data.GetCurrentMagazine();
27 int current = magazine.GetAmmoCount();
28 int max = magazine.GetMaxAmmoCount();
30 if (m_bComparePercentage)
34 float perc = (current/(float)max) * 100.0;
35 result = SCR_Comparer<float>.Compare(m_eOperator, perc, m_fValue);
36 return GetReturnResult(result);
38 return GetReturnResult(
false);
41 result = SCR_Comparer<int>.Compare(m_eOperator, current, (
int)m_fValue);
42 return GetReturnResult(result);