Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_SetSpeedManualCameraComponent.c
Go to the documentation of this file.
1 
4 [BaseContainerProps(), SCR_BaseManualCameraComponentTitle()]
6 {
7  [Attribute("2.5")]
8  protected float m_fGamepadCameraSpeed;
9 
10  [Attribute("12")]
11  protected float m_fGamepadCameraSpeedBoosted;
12 
13  protected bool m_bIsBoosted;
14  protected bool m_bIsUsingGamepad;
15 
16 // [Attribute("3")]
17 // float m_fLayoutDuration;
18 //
19 // [Attribute(params: "layout")]
20 // private ResourceName m_Layout;
21 // private TextWidget m_Widget;
22 // private float m_fWidgetAlpha;
23 
24  //------------------------------------------------------------------------------------------------
25  protected void OnInputDeviceIsGamepad(bool isGamepad)
26  {
27  m_bIsUsingGamepad = isGamepad;
28 
29  if (!m_bIsUsingGamepad)
30  m_bIsBoosted = false;
31  }
32 
33  //------------------------------------------------------------------------------------------------
34  protected void ManualCameraSpeedToggle()
35  {
36  if (!IsEnabled())
37  return;
38 
39  m_bIsBoosted = !m_bIsBoosted;
40 
41  //UpdateWidget();
42  }
43 
44 // //------------------------------------------------------------------------------------------------
45 // protected void UpdateWidget()
46 // {
47 // if (!m_Widget) return;
48 //
49 // if (!m_bIsBoosted)
50 // m_Widget.SetTextFormat("#AR-ValueUnit_Short_Multiplier", m_fGamepadCameraSpeed);
51 // else
52 // m_Widget.SetTextFormat("#AR-ValueUnit_Short_Multiplier", m_fGamepadCameraSpeedBoosted);
53 //
54 // m_Widget.SetVisible(true);
55 // m_fWidgetAlpha = 1 + m_fLayoutDuration;
56 // }
57 
58 // //------------------------------------------------------------------------------------------------
59 // protected void FadeOutWidget(float timeSlice)
60 // {
61 // if (!m_Widget || !m_Widget.IsVisible()) return;
62 //
63 // m_fWidgetAlpha -= timeSlice;
64 // if (m_fWidgetAlpha > 0)
65 // {
66 // m_Widget.SetOpacity(Math.Clamp(m_fWidgetAlpha, 0, 1));
67 // }
68 // else
69 // {
70 // m_Widget.SetVisible(false);
71 // }
72 // }
73 
74  //------------------------------------------------------------------------------------------------
75  override void EOnCameraFrame(SCR_ManualCameraParam param)
76  {
77  if (!param.isManualInputEnabled || !m_bIsUsingGamepad)
78  return;
79 
80  if (!m_bIsBoosted)
81  {
82  param.multiplier *= m_fGamepadCameraSpeed;
83  }
84  else
85  {
86  param.multiplier *= m_fGamepadCameraSpeedBoosted;
87 
88  float lateral = GetInputManager().GetActionValue("ManualCameraMoveLateral");
89  float vertical = GetInputManager().GetActionValue("ManualCameraMoveVertical");
90  float longitudinal = GetInputManager().GetActionValue("ManualCameraMoveLongitudinal");
91 
92  if (lateral == 0 && vertical == 0 && longitudinal == 0)
93  {
94  m_bIsBoosted = false;
95  //UpdateWidget()
96  }
97  }
98  }
99 
100  //------------------------------------------------------------------------------------------------
101  override bool EOnCameraInit()
102  {
103  GetGame().OnInputDeviceIsGamepadInvoker().Insert(OnInputDeviceIsGamepad);
104 
105  GetInputManager().AddActionListener("ManualCameraSpeedToggle", EActionTrigger.DOWN, ManualCameraSpeedToggle);
106 
107  //m_Widget = TextWidget.Cast(GetCameraEntity().CreateCameraWidget(m_Layout, false));
108  return true;
109  }
110 
111  //------------------------------------------------------------------------------------------------
112  override void EOnCameraExit()
113  {
114  GetGame().OnInputDeviceIsGamepadInvoker().Remove(OnInputDeviceIsGamepad);
115 
116  GetInputManager().RemoveActionListener("ManualCameraSpeedToggle", EActionTrigger.DOWN, ManualCameraSpeedToggle);
117 
118  //if (m_Widget) m_Widget.RemoveFromHierarchy();
119  }
120 }
m_bIsUsingGamepad
protected bool m_bIsUsingGamepad
Definition: SCR_CampaignTutorialComponentArland.c:58
SCR_BaseManualCameraComponent
Parent class from which all SCR_ManualCamera components inherit.
Definition: SCR_BaseManualCameraComponent.c:5
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_SetSpeedManualCameraComponent
Instantly set the speed to a value within a sequence.
Definition: SCR_SetSpeedManualCameraComponent.c:5
Attribute
typedef Attribute
Post-process effect of scripted camera.
IsEnabled
int IsEnabled()
Definition: SCR_BaseManualCameraComponent.c:99
SCR_ManualCameraParam
Parameter for carrying information between individual camera components.
Definition: SCR_ManualCameraParam.c:5
GetInputManager
protected InputManager GetInputManager()
Definition: SCR_BaseManualCameraComponent.c:65
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