Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
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  {
40  m_iCurrentIndex = index;
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);
55  m_fCurrentFOV = m_aFOVs[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_VariableSightsFOVInfo
Definition: SCR_VariableSightsFOVInfo.c:1
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_BaseVariableSightsFOVInfo
Definition: SCR_BaseVariableSightsFOVInfo.c:1
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24