Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ScenarioFrameworkTaskKill.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
3 {
4 };
5 
6 //------------------------------------------------------------------------------------------------
8 {
9 
10  //------------------------------------------------------------------------------------------------
11  void OnObjectDamage(EDamageState state)
12  {
13  if (state != EDamageState.DESTROYED || !m_Asset || !m_SupportEntity)
14  return;
15 
16  SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.Cast(m_Asset.FindComponent(SCR_DamageManagerComponent));
17  if (objectDmgManager)
18  objectDmgManager.GetOnDamageStateChanged().Remove(OnObjectDamage);
19 
20  m_SupportEntity.FinishTask(this);
21  }
22 
23  //------------------------------------------------------------------------------------------------
24  override void RehookTaskAsset(IEntity object)
25  {
26  if (!object)
27  return;
28 
29  m_Asset = object;
30 
31  SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.Cast(m_Asset.FindComponent(SCR_DamageManagerComponent));
32  if (objectDmgManager)
33  objectDmgManager.GetOnDamageStateChanged().Insert(OnObjectDamage);
34  }
35 
36  //------------------------------------------------------------------------------------------------
37  override bool SetSupportEntity()
38  {
40 
41  if (!m_SupportEntity)
42  {
43  Print("ScenarioFramework: Task Kill support entity not found in the world, task won't be created!", LogLevel.ERROR);
44  return false;
45  }
46 
47  return true;
48  }
49 
50  //------------------------------------------------------------------------------------------------
51  override void Init()
52  {
53  super.Init();
54 
55  if (!m_Asset)
56  return;
57 
58  SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.Cast(m_Asset.FindComponent(SCR_DamageManagerComponent));
59  if (objectDmgManager)
60  objectDmgManager.GetOnDamageStateChanged().Insert(OnObjectDamage);
61  }
62 }
SCR_ScenarioFrameworkTaskKillSupportEntity
Definition: SCR_ScenarioFrameworkTaskKillSupportEntity.c:8
EDamageState
EDamageState
Definition: EDamageState.c:12
SCR_TaskKill
Definition: SCR_ScenarioFrameworkTaskKill.c:7
GetTaskManager
SCR_BaseTaskManager GetTaskManager()
Definition: SCR_BaseTaskManager.c:7
SCR_ScenarioFrameworkTask
Definition: SCR_ScenarioFrameworkTask.c:7
SCR_ScenarioFrameworkTaskClass
Definition: SCR_ScenarioFrameworkTask.c:2
SCR_TaskKillClass
Definition: SCR_ScenarioFrameworkTaskKill.c:2