Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_HelicopterEngineAction.c
Go to the documentation of this file.
2 {
4  [Attribute(defvalue: "3.0", desc: "Maximum animation signal phase to be reached within ActionDuration")]
5  protected float m_fEngineTogglePhase;
6 
7  protected SignalsManagerComponent m_SignalManager;
8  protected int m_iStartingSequenceSignal;
9  protected float m_fStartingSequencePhase;
10 
11  //------------------------------------------------------------------------------------------------
12  override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
13  {
14  super.Init(pOwnerEntity, pManagerComponent);
15 
16  m_SignalManager = SignalsManagerComponent.Cast(pOwnerEntity.FindComponent(SignalsManagerComponent));
17  if (!m_SignalManager)
18  return;
19  m_iStartingSequenceSignal = m_SignalManager.AddOrFindSignal("startingSequence");
20  }
21 
22  override bool CanBeShownScript(IEntity user)
23  {
24  return m_SignalManager && super.CanBeShownScript(user);
25  }
26 
27  //------------------------------------------------------------------------------------------------
28  override void PerformContinuousAction(IEntity pOwnerEntity, IEntity pUserEntity, float timeSlice)
29  {
30  float duration = Math.AbsFloat(GetActionDuration());
31  if (duration > 0)
32  {
33  m_fStartingSequencePhase += m_fEngineTogglePhase * timeSlice / duration;
34  m_fStartingSequencePhase = Math.Min(m_fStartingSequencePhase, m_fEngineTogglePhase);
35  }
36  else
37  {
38  m_fStartingSequencePhase = m_fEngineTogglePhase;
39  }
40 
41  if (m_SignalManager)
42  {
43  if (m_bTargetState)
44  m_SignalManager.SetSignalValue(m_iStartingSequenceSignal, m_fStartingSequencePhase);
45  else
46  m_SignalManager.SetSignalValue(m_iStartingSequenceSignal, m_fEngineTogglePhase - m_fStartingSequencePhase);
47  }
48 
49  if (float.AlmostEqual(m_fStartingSequencePhase, m_fEngineTogglePhase))
50  SetState(m_bTargetState);
51  }
52 
53  override void OnActionStart(IEntity pUserEntity)
54  {
55  if (m_SignalManager)
56  m_fStartingSequencePhase = m_SignalManager.GetSignalValue(m_iStartingSequenceSignal);
57 
58  if (!m_bTargetState)
59  m_iStartingSequenceSignal = m_fEngineTogglePhase - m_fStartingSequencePhase;
60  }
61 
62  //------------------------------------------------------------------------------------------------
63  override void SetState(bool enable)
64  {
65  super.SetState(enable);
66 
67  if (!m_SignalManager)
68  return;
69 
70  if (enable)
71  m_SignalManager.SetSignalValue(m_iStartingSequenceSignal, m_fEngineTogglePhase);
72  else
73  m_SignalManager.SetSignalValue(m_iStartingSequenceSignal, 0);
74  }
75 };
SCR_EngineAction
Definition: SCR_EngineAction.c:1
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_HelicopterEngineAction
Definition: SCR_HelicopterEngineAction.c:1
m_SignalManager
protected SignalsManagerComponent m_SignalManager
Definition: SCR_WristwatchComponent.c:55
Attribute
typedef Attribute
Post-process effect of scripted camera.