9 protected IEntity m_Asset;
11 protected SCR_ScenarioFrameworkLayerTask m_LayerTask;
12 protected SCR_ScenarioFrameworkSlotTask m_SlotTask;
13 protected string m_sTaskExecutionBriefing;
14 string m_sTaskIntroVoiceline;
15 protected string m_sSpawnedEntityName;
24 void SetLayerTask(SCR_ScenarioFrameworkLayerTask layer)
30 SCR_ScenarioFrameworkLayerTask GetLayerTask()
42 SCR_GameModeSFManager gameModeManager = SCR_GameModeSFManager.Cast(
GetGame().
GetGameMode().FindComponent(SCR_GameModeSFManager));
43 if (!gameModeManager || !gameModeManager.IsMaster())
48 m_SlotTask.OnTaskStateChanged(newState);
52 SCR_ScenarioFrameworkSlotTask slotTask = m_LayerTask.GetSlotTask();
54 slotTask.OnTaskStateChanged(newState);
56 Print(
"ScenarioFramework: Task Subject not found for task", LogLevel.ERROR);
59 m_LayerTask.OnTaskStateChanged(previousState, newState);
62 gameModeManager.PopUpMessage(GetTitle(),
"#AR-Tasks_StatusFinished-UC",
m_TargetFaction.GetFactionKey());
65 gameModeManager.PopUpMessage(GetTitle(),
"#AR-Tasks_StatusFailed-UC",
m_TargetFaction.GetFactionKey());
69 override void Finish(
bool showMsg =
true)
72 super.Finish(showMsg);
76 void SetTaskAsset(IEntity
object)
82 void RehookTaskAsset(IEntity
object)
87 m_SupportEntity.SetTaskEntity(m_Asset);
97 void SetSlotTask(SCR_ScenarioFrameworkSlotTask slotTask)
99 m_SlotTask = slotTask;
103 SCR_ScenarioFrameworkSlotTask GetSlotTask()
111 return m_SupportEntity;
115 void SetTaskExecutionBriefing(
string text)
117 m_sTaskExecutionBriefing = text;
121 string GetTaskExecutionBriefing()
123 return m_sTaskExecutionBriefing;
127 void SetSpawnedEntityName(
string name)
129 m_sSpawnedEntityName = name;
133 string GetSpawnedEntityName()
135 return m_sSpawnedEntityName;
140 override string GetTaskListTaskText()
142 return string.Format(WidgetManager.Translate(
m_sDescription, m_sSpawnedEntityName));
146 protected bool SetSupportEntity()
150 if (!m_SupportEntity)
152 Print(
"ScenarioFramework: Default Task support entity not found in the world, task won't be created!", LogLevel.ERROR);
156 return m_SupportEntity !=
null;
160 override void Serialize(ScriptBitWriter writer)
162 super.Serialize(writer);
164 writer.WriteString(m_sTaskExecutionBriefing);
165 writer.WriteString(m_sSpawnedEntityName);
169 override void Deserialize(ScriptBitReader reader)
171 super.Deserialize(reader);
173 string taskExecutionBriefing;
175 reader.ReadString(taskExecutionBriefing);
176 SetTaskExecutionBriefing(taskExecutionBriefing);
178 string spawnedEntityName;
180 reader.ReadString(spawnedEntityName);
181 SetSpawnedEntityName(spawnedEntityName);
191 if (!m_SupportEntity)
194 m_Asset = m_SupportEntity.GetTaskEntity();
198 m_Asset = m_SlotTask.GetSpawnedEntity();
202 m_SupportEntity.CancelTask(this.GetTaskID());
203 Print(
"ScenarioFramework: Task subject not found!", LogLevel.ERROR);
207 m_SupportEntity.SetTaskEntity(m_Asset);
210 SCR_GameModeSFManager gameModeManager = SCR_GameModeSFManager.Cast(
GetGame().
GetGameMode().FindComponent(SCR_GameModeSFManager));
211 if (!gameModeManager)
216 override void EOnInit(IEntity owner)
218 super.EOnInit(owner);