Ejemplo n.º 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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
 private RuntimeTask Initialize_Wait(Task t)
 {
     RuntimeTask rt = null;
     rt = new RuntimeTask(t, "Wait_UniRx");
     rt.taskFunc = Wait;
     return rt;
 }
Ejemplo n.º 4
0
        private RuntimeTask Initialize_Wait(Task t)
        {
            RuntimeTask rt = null;

            rt          = new RuntimeTask(t, "Wait_UniRx");
            rt.taskFunc = Wait;
            return(rt);
        }
Ejemplo n.º 5
0
 private void FinishTask()
 {
     if (_aliveBehavior is Task)
     {
         RuntimeTask rt = GetRuntimeTask(_aliveBehavior as Task);
         rt.Finish();
     }
 }
Ejemplo n.º 6
0
 private void StartTask(Node node)
 {
     _aliveBehavior = node;
     if (node is Task)
     {
         RuntimeTask rt = GetRuntimeTask(_aliveBehavior as Task);
         rt.Start();
     }
 }
Ejemplo n.º 7
0
        private RuntimeTask GetRuntimeTask(Task task)
        {
            RuntimeTask value = null;

            if (_runtimeTasks.ContainsKey(task))
            {
                value = _runtimeTasks[task];
            }
            return(value);
        }