Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_VariableSightsFOVInfo.c
Go to the documentation of this file.
2{
3 [Attribute("", UIWidgets.Auto, desc: "Individual FOV settings.")]
4 protected ref array<float> m_aFOVs;
5
6 [Attribute("6.0", UIWidgets.Slider, desc: "Interpolation speed.", params: "0 100 0.1")]
7 protected float m_fInterpolationSpeed;
8
10 protected float m_fCurrentFOV = 60.0;
11
13 protected int m_iCurrentIndex = -1;
14
15 //------------------------------------------------------------------------------------------------
19 override int GetCount()
20 {
21 return m_aFOVs.Count();
22 }
23
24 //------------------------------------------------------------------------------------------------
28 override int GetCurrentIndex()
29 {
30 return m_iCurrentIndex;
31 }
32
33 //------------------------------------------------------------------------------------------------
38 protected override void SetIndex(int index)
39 {
41 }
42
43 //------------------------------------------------------------------------------------------------
49 protected override void OnInit(IEntity owner, BaseSightsComponent sights)
50 {
51 // Initialize to default (first available) value
52 if (GetCount() > 0)
53 {
54 SetIndex(0);
56 }
57 else
58 m_fCurrentFOV = 60.0;
59 }
60
61 //------------------------------------------------------------------------------------------------
68 protected override void OnUpdate(IEntity owner, BaseSightsComponent sights, float timeSlice)
69 {
70 if (!m_aFOVs.IsIndexValid(m_iCurrentIndex))
71 return;
72
73 float target = m_aFOVs[m_iCurrentIndex];
74 m_fCurrentFOV = Math.Lerp(m_fCurrentFOV, target, timeSlice * m_fInterpolationSpeed);
75 }
76
77 //------------------------------------------------------------------------------------------------
79 override bool IsAdjusting()
80 {
81 if (!m_aFOVs.IsIndexValid(m_iCurrentIndex))
82 return false;
83
84 return !float.AlmostEqual(m_fCurrentFOV, m_aFOVs[m_iCurrentIndex]);
85 }
86
87 //------------------------------------------------------------------------------------------------
92 protected override float GetCurrentFOV()
93 {
94 return m_fCurrentFOV;
95 }
96
97 //------------------------------------------------------------------------------------------------
104 override float GetBaseFOV()
105 {
106 if (!m_aFOVs.IsEmpty())
107 return m_aFOVs[0];
108
109 return m_fCurrentFOV;
110 }
111};
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition Math.c:13
override void SetIndex(int index)
override bool IsAdjusting()
Returns true when current FOV of the optic does not match the target FOV.
override void OnUpdate(IEntity owner, BaseSightsComponent sights, float timeSlice)
float m_fCurrentFOV
Immediate field of view value.
int m_iCurrentIndex
Currently selected FOV or -1 if none.
override void OnInit(IEntity owner, BaseSightsComponent sights)
SCR_FieldOfViewSettings Attribute