Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_LightSlot.c
Go to the documentation of this file.
2 {
3  [Attribute(defvalue: "", uiwidget: UIWidgets.EditBox, desc: "Hit zone", category: "Damage")]
4  protected string m_sHitZoneName;
5 
6  [Attribute(defvalue: "", uiwidget: UIWidgets.EditBox, desc: "Name of the sound event that should be called when the lights are activated.", category: "Sounds")]
7  protected string m_sLightOnEventName;
8 
9  [Attribute(defvalue: "", uiwidget: UIWidgets.EditBox, desc: "Name of the sound event that should be called when the lights are deactivated.", category: "Sounds")]
10  protected string m_sLightOffEventName;
11 
12  protected bool m_bIsActive;
13  protected SoundComponent m_SoundComponent;
14 
15  protected ref ScriptInvoker m_OnLightStateChanged; // TODO: ScriptInvokerBool
16 
17  //------------------------------------------------------------------------------------------------
20  ScriptInvoker GetOnLightStateChanged()
21  {
22  if (!m_OnLightStateChanged)
23  m_OnLightStateChanged = new ScriptInvoker();
24 
25  return m_OnLightStateChanged;
26  }
27 
28  //------------------------------------------------------------------------------------------------
29  override void OnLightStateChanged(bool newState)
30  {
31  if (m_bIsActive == newState)
32  return;
33 
34  m_bIsActive = newState;
35  if (m_OnLightStateChanged)
36  m_OnLightStateChanged.Invoke(newState);
37  }
38 
39  //------------------------------------------------------------------------------------------------
40  override void OnInit(IEntity owner)
41  {
42  super.OnInit(owner);
43  m_SoundComponent = SoundComponent.Cast(owner.FindComponent(SoundComponent));
44 
45  if (m_SoundComponent)
46  GetOnLightStateChanged().Insert(PlaySound);
47  }
48 
49  //------------------------------------------------------------------------------------------------
51  void PlaySound(bool newState)
52  {
53  string eventName;
54 
55  if (newState)
56  eventName = m_sLightOnEventName;
57  else
58  eventName = m_sLightOffEventName;
59 
60  if (m_SoundComponent && !eventName.IsEmpty())
61  m_SoundComponent.SoundEvent(eventName);
62  }
63 
64  //------------------------------------------------------------------------------------------------
66  string GetHitZoneName()
67  {
68  return m_sHitZoneName;
69  }
70 };
BaseLightSlot
Definition: BaseLightSlot.c:7
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
Attribute
typedef Attribute
Post-process effect of scripted camera.
m_SoundComponent
protected SoundComponent m_SoundComponent
Definition: SCR_RotorDamageManagerComponent.c:9
m_bIsActive
SCR_HintSequenceComponentClass m_bIsActive
SCR_LightSlot
Definition: SCR_LightSlot.c:1
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180