Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ZoomManualCameraComponent.c
Go to the documentation of this file.
1 
4 [BaseContainerProps(), SCR_BaseManualCameraComponentTitle()]
6 {
7  protected static const float INERTIA_THRESHOLD = 0.001;
8 
9  [Attribute(defvalue: "1", uiwidget: UIWidgets.Slider, desc: "Minimum field of view", params: "0 180 1")]
10  protected float m_fMinFOV;
11 
12  [Attribute(defvalue: "120", uiwidget: UIWidgets.Slider, desc: "Maximum field of view", params: "0 180 1")]
13  protected float m_fMaxFOV;
14 
15  [Attribute(defvalue: "0.1", desc: "Zoom value coefficient")]
16  protected float m_fCoef;
17 
18  [Attribute(defvalue: "0.08", desc: "Indertia strength. Larger values mean more inertia.")]
19  protected float m_fInertiaStrength;
20 
21  protected float m_fTargetFOV;
22  protected bool m_bIsAnimating;
23  protected bool m_bIsInstant;
24  protected ref ScriptInvoker m_OnZoomChange = new ScriptInvoker();
25 
26  //------------------------------------------------------------------------------------------------
28  ScriptInvoker GetOnZoomChange()
29  {
30  return m_OnZoomChange;
31  }
32 
33  //------------------------------------------------------------------------------------------------
34  override void EOnCameraSave(SCR_ManualCameraComponentSave data)
35  {
36  if (m_fTargetFOV != 0)
37  data.m_aValues = {m_fTargetFOV};
38  }
39 
40  //------------------------------------------------------------------------------------------------
41  override void EOnCameraLoad(SCR_ManualCameraComponentSave data)
42  {
43  m_fTargetFOV = data.m_aValues[0];
44  m_bIsInstant = true;
45  }
46 
47  //------------------------------------------------------------------------------------------------
48  override void EOnCameraReset()
49  {
50  m_fTargetFOV = GetCameraEntity().GetDefaultFOV();
51  m_bIsAnimating = true;
52  }
53 
54  //------------------------------------------------------------------------------------------------
55  override void EOnCameraFrame(SCR_ManualCameraParam param)
56  {
57  if (!param.isManualInputEnabled)
58  return;
59 
60  if (GetInputManager().GetActionValue("ManualCameraZoomReset"))
61  {
62  m_fTargetFOV = GetCameraEntity().GetDefaultFOV();
63  m_bIsAnimating = true;
64  }
65 
66  float input = 0;
67  if (GetInputManager().IsUsingMouseAndKeyboard() || GetInputManager().GetActionValue("ManualCameraModifier"))
68  input = GetInputManager().GetActionValue("ManualCameraZoom");
69 
70  if (input != 0)
71  {
72  m_fTargetFOV = Math.Clamp(param.fov * (1 - input * m_fCoef), m_fMinFOV, m_fMaxFOV);
73  m_bIsAnimating= true;
74  }
75 
76  if (m_bIsInstant)
77  {
78  m_bIsInstant = false;
79  param.fov = m_fTargetFOV;
80  param.isDirty = true;
81  m_OnZoomChange.Invoke(param.fov);
82  }
83  else if (m_bIsAnimating)
84  {
85  param.fov = Math.Lerp(param.fov, m_fTargetFOV, Math.Min(param.timeSlice / m_fInertiaStrength, 1));
86  param.isDirty = true;
87  if (Math.AbsFloat(param.fov - m_fTargetFOV) < INERTIA_THRESHOLD)
88  m_bIsAnimating = false;
89 
90  m_OnZoomChange.Invoke(param.fov);
91  }
92  }
93 
94  //------------------------------------------------------------------------------------------------
95  override bool EOnCameraInit()
96  {
97  return true;
98  }
99 }
m_fInertiaStrength
private float m_fInertiaStrength
Definition: SCR_TooltipManagerEditorUIComponent.c:14
SCR_BaseManualCameraComponent
Parent class from which all SCR_ManualCamera components inherit.
Definition: SCR_BaseManualCameraComponent.c:5
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_ManualCameraComponentSave
Definition: SCR_ManualCameraSave.c:15
GetCameraEntity
protected SCR_ManualCamera GetCameraEntity()
Definition: SCR_BaseManualCameraComponent.c:59
SCR_ManualCameraParam
Parameter for carrying information between individual camera components.
Definition: SCR_ManualCameraParam.c:5
m_bIsAnimating
bool m_bIsAnimating
Definition: SCR_VonDisplay.c:9
GetInputManager
protected InputManager GetInputManager()
Definition: SCR_BaseManualCameraComponent.c:65
SCR_ZoomManualCameraComponent
Adjust camera field of view.
Definition: SCR_ZoomManualCameraComponent.c:5
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468