Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_RotateModifierManualCameraComponent.c
Go to the documentation of this file.
1 
4 [BaseContainerProps(), SCR_BaseManualCameraComponentTitle()]
6 {
7  private bool m_bRotate;
8 
9  //------------------------------------------------------------------------------------------------
10  protected void OnInputDeviceIsGamepad(bool isGamepad)
11  {
12  //--- Always rotate with controller, cancel rotation when switching to mouse and keyboard
13  m_bRotate = isGamepad;
14  }
15 
16  //------------------------------------------------------------------------------------------------
17  protected void ManualCameraRotateDown()
18  {
19  if (!IsEnabled())
20  return;
21 
22  if (GetCameraEntity().GetCameraParam().isCursorEnabled)
23  m_bRotate = true;
24  }
25 
26  //------------------------------------------------------------------------------------------------
27  protected void ManualCameraRotateUp()
28  {
29  if (!IsEnabled())
30  return;
31 
32  m_bRotate = false;
33  }
34 
35  //------------------------------------------------------------------------------------------------
36  override void EOnCameraFrame(SCR_ManualCameraParam param)
37  {
38  if (!param.isManualInputEnabled) return;
39 
40  if (m_bRotate)
41  param.flag = param.flag | EManualCameraFlag.ROTATE;
42  else
43  param.flag = param.flag & ~EManualCameraFlag.ROTATE;
44  }
45 
46  //------------------------------------------------------------------------------------------------
47  override bool EOnCameraInit()
48  {
49  OnInputDeviceIsGamepad(!GetGame().GetInputManager().IsUsingMouseAndKeyboard());
50  GetGame().OnInputDeviceIsGamepadInvoker().Insert(OnInputDeviceIsGamepad);
51  GetInputManager().AddActionListener("ManualCameraRotate", EActionTrigger.DOWN, ManualCameraRotateDown);
52  GetInputManager().AddActionListener("ManualCameraRotate", EActionTrigger.UP, ManualCameraRotateUp);
53  return true;
54  }
55 
56  //------------------------------------------------------------------------------------------------
57  override void EOnCameraExit()
58  {
59  GetGame().OnInputDeviceIsGamepadInvoker().Remove(OnInputDeviceIsGamepad);
60  GetInputManager().RemoveActionListener("ManualCameraRotate", EActionTrigger.DOWN, ManualCameraRotateDown);
61  GetInputManager().RemoveActionListener("ManualCameraRotate", EActionTrigger.UP, ManualCameraRotateUp);
62  }
63 }
SCR_BaseManualCameraComponent
Parent class from which all SCR_ManualCamera components inherit.
Definition: SCR_BaseManualCameraComponent.c:5
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_RotateModifierManualCameraComponent
Basic camera rotation with modifier button held (RMB by default)
Definition: SCR_RotateModifierManualCameraComponent.c:5
EManualCameraFlag
EManualCameraFlag
Definition: EManualCameraFlag.c:7
IsEnabled
int IsEnabled()
Definition: SCR_BaseManualCameraComponent.c:99
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
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