14 protected ref array<ref SCR_EffectModule> m_aEffectModules;
15 protected ref array<ref SCR_EffectModule> m_aEffectModulesActive = {};
16 protected IEntity m_pOwner;
17 protected bool m_bInitiated =
false;
18 protected const bool ON_PHYSIC_ONLY =
false;
19 protected const bool ON_FRAME =
true;
28 m_aEffectModulesActive.RemoveItem(pModule);
34 if (m_aEffectModulesActive.Find(pModule) == -1)
37 m_aEffectModulesActive.Insert(pModule);
43 protected void ActivateAllModules(
bool bPhysics)
49 if (pModule.GetTickOnFrame() == bPhysics)
50 ActivateModule(pModule);
56 protected void DeactivateAllModules(
bool bPhysics)
58 for (
int i = 0; i < m_aEffectModulesActive.Count(); i++)
60 if (!m_aEffectModulesActive[i])
62 if (m_aEffectModulesActive[i].GetTickOnFrame() == bPhysics)
63 DeactivateModule(m_aEffectModulesActive[i]);
68 protected void InitModules(
bool bTickOnFrame =
false)
74 if (m_aEffectModulesActive.Find(pModule) != -1)
76 if (pModule.GetTickOnFrame() == bTickOnFrame)
79 ActivateModule(pModule);
89 override void _WB_AfterWorldUpdate(IEntity owner,
float timeSlice)
95 pModule.WB_Update(owner, timeSlice);
101 void UpdateModules(
float timeSlice)
107 pModule.Update(m_pOwner, timeSlice);
112 override void EOnInit(IEntity owner)
114 ActivateAllModules(ON_FRAME);
117 override void EOnPhysicsActive(IEntity owner,
bool activeState)
119 if (System.IsConsoleApp())
125 ActivateAllModules(ON_PHYSIC_ONLY);
130 DeactivateAllModules(ON_PHYSIC_ONLY);
134 override void EOnDeactivate(IEntity owner)
136 super.EOnDeactivate(owner);
138 DisconnectFromEffectManagerSystem();
141 override void EOnActivate(IEntity owner)
143 super.EOnActivate(owner);
145 ConnectToEffectManagerSystem();
149 override void OnPostInit(IEntity owner)
151 super.OnPostInit(owner);
155 if (System.IsConsoleApp())
158 SetEventMask(owner, EntityEvent.INIT | EntityEvent.PHYSICSACTIVE);
159 ConnectToEffectManagerSystem();
162 override void OnDelete(IEntity owner)
164 DisconnectFromEffectManagerSystem();
166 super.OnDelete(owner);
169 private void ConnectToEffectManagerSystem()
171 World world = m_pOwner.GetWorld();
176 updateSystem.Register(
this);
179 private void DisconnectFromEffectManagerSystem()
181 World world = m_pOwner.GetWorld();
186 updateSystem.Unregister(
this);
191 override void _WB_OnInit(IEntity owner, inout vector mat[4], IEntitySource src)
197 pModule.WB_OnInit(owner, mat, src);
213 SCR_HelicopterControllerComponent GetHelicopterController()
217 return SCR_HelicopterControllerComponent.Cast(m_pOwner.FindComponent(SCR_HelicopterControllerComponent));
221 override void EOnInit(IEntity owner)
223 super.EOnInit(owner);