Example #1
0
        private void InitializeTask(Task task)
        {
            RuntimeTask rt = null;
            if (task is Wait)
                rt = Initialize_Wait(task);
            else
            {
                rt = new RuntimeTask(task, task.targetMethod);
                MonoBehaviour comp = GetEqualTypeComponent(task.targetScript.GetType()) as MonoBehaviour;
                if (comp == null)
                {
                    comp = gameObject.AddComponent(task.targetScript.GetType()) as MonoBehaviour;
                    IInitializable initializable = comp as IInitializable;
                    initializable.Initialize();
                }

                if (task.isCoroutine)
                    rt.comp = comp;
                else
                {
                    Func<IDisposable> tempFunc = Delegate.CreateDelegate(typeof(Func<IDisposable>), comp, task.targetMethod) as Func<IDisposable>;
                    rt.taskFunc = tempFunc;
                }
            }

            _runtimeTasks.Add(task, rt);
        }
Example #2
0
 private RuntimeTask Initialize_Wait(Task t)
 {
     RuntimeTask rt = null;
     rt = new RuntimeTask(t, "Wait_UniRx");
     rt.taskFunc = Wait;
     return rt;
 }
Example #3
0
 private RuntimeTask GetRuntimeTask(Task task)
 {
     RuntimeTask value = null;
     if (_runtimeTasks.ContainsKey(task))
     {
         value = _runtimeTasks[task];
     }
     return value;
 }
Example #4
0
 public RuntimeTask(Task parent, string methodName)
 {
     this.parent = parent;
     this.methodName = methodName;
 }