//initialize the task launcher component public void Init(GameManager gameMgr, FactionEntity factionEntity) { ///assign the components this.gameMgr = gameMgr; FactionEntity = factionEntity; foreach (FactionEntityTask task in tasksList) //init the tasks { task.Init(gameMgr, FactionEntity); } FactionEntity.FactionMgr.TaskLaunchers.Add(this); //add this component to the faction's task launcher list CustomEvents.OnTaskLauncherAdded(this); //trigger the custom event Initiated = true; }
//initialize the task launcher component public void Init(GameManager gameMgr, FactionEntity factionEntity) { ///assign the components this.gameMgr = gameMgr; FactionEntity = factionEntity; for (int i = 0; i < tasksList.Count; i++) //init the tasks { if (tasksList[i].Init(gameMgr, FactionEntity, i)) //if the task successfully initializes then it can be used by the task launcher: { tasksDic.Add(tasksList[i].GetCode(), tasksList[i]); } } CustomEvents.OnTaskLauncherAdded(this); //trigger the custom event Initiated = true; }