static void ExecuteFirstTask() { if (taskPool.Count == 0) { if (OnScheduleFinished != null) { OnScheduleFinished.Invoke(currentScheduleID); } return; } currentExecutingTask = taskPool[0]; currentExecutingTask.OnComplete += RemoveTaskFromPool; currentExecutingTask.Execute(); }
public override void Execute() { Debug.Log("____ UpdateOfflineTasks: ____"); Type type = Type.GetType(serializedTask.classType); //target type Debug.Log("type: " + type + " - data: " + serializedTask.data); object instanceObject = Activator.CreateInstance(type, new object[] { serializedTask.data }); // an instance of target type gameTask = (GameTask)instanceObject; gameTask.id = serializedTask.id; gameTask.SetAdditionalData(serializedTask.additionalData); gameTask.executionTime = DateTime.Parse(serializedTask.executionTime); gameTask.OnComplete += MoveNext; gameTask.OnError += RetryTask; gameTask.Execute(); }