3 ref array<ref SCR_HitZone> m_aScriptedHitZones = {};
7 bool RegisterSignal(SCR_DamageManagerComponent hitZoneContainerComponent,
SCR_HitZoneStateSignalData hitZoneStateSignalData, SignalsManagerComponent signalsManagerComponent)
9 array<string> hitZoneNames = hitZoneStateSignalData.m_aHitZoneNames;
10 if (!hitZoneNames || hitZoneNames.Count() == 0)
12 Print(
"AUDIO: SCR_HitZoneStateSignal: Missing HitZoneNames", LogLevel.WARNING);
16 foreach (
string hitZoneName : hitZoneNames)
18 HitZone hitZone = hitZoneContainerComponent.GetHitZoneByName(hitZoneName);
23 hitzone.GetOnDamageStateChanged().Insert(OnStateChanged);
24 m_aScriptedHitZones.Insert(hitzone);
27 if (m_aScriptedHitZones.Count() == 0)
29 Print(
"AUDIO: SCR_HitZoneStateSignal: No HitZone found", LogLevel.WARNING);
33 string signalName = hitZoneStateSignalData.m_sSignalName;
34 if (signalName.IsEmpty())
36 Print(
"AUDIO: SCR_HitZoneStateSignal: Missing signal name", LogLevel.WARNING);
40 m_iSignalIdx = signalsManagerComponent.AddOrFindSignal(signalName);
46 void UnregisterSignal()
50 hitzone.GetOnDamageStateChanged().Remove(OnStateChanged);
55 protected void OnStateChanged()
61 int state = DamageStateToSignalValue(hitzone.GetDamageState());
66 IEntity owner = m_aScriptedHitZones[0].GetOwner();
70 SignalsManagerComponent signalsManager = SignalsManagerComponent.Cast(owner.GetRootParent().FindComponent(SignalsManagerComponent));
74 signalsManager.SetSignalValue(m_iSignalIdx, max);
78 static int DamageStateToSignalValue(
EDamageState damageState)