Inheritance: TaskCollection
	// Use this for initialization
	void Start () 
	{
		ParallelTaskCollection pt = new ParallelTaskCollection();
		SerialTaskCollection	st = new SerialTaskCollection();
		
		st.Add(Print("s1"));
		st.Add(Print("s2"));
		st.Add(DoSomethingAsynchonously());
		st.Add(Print("s3"));
		st.Add(Print("s4"));
		
		pt.Add(Print("1"));
		pt.Add(Print("2"));
		pt.Add(WWWTest("www.google.com"));
		pt.Add(WWWTest("http://download.thinkbroadband.com/5MB.zip"));
		pt.Add(WWWTest("www.ebay.com"));
		pt.Add(Print("3"));
		pt.Add(Print("4"));
		pt.Add(st);
		pt.Add(Print("5"));
		pt.Add(Print("6"));
		pt.Add(Print("7"));
			
		TaskRunner.Instance.Run(pt.GetEnumerator());
	}
Exemplo n.º 2
0
		public SingleTask(IEnumerator enumerator)
		{
			if (enumerator is SingleTask || enumerator is PausableTask || enumerator is AsyncTask)
				throw new ArgumentException("Use of incompatible Enumerator, cannot be SingleTask/PausableTask/AsyncTask");
			
			_task = new SerialTaskCollection();
			_task.Add(enumerator);
			
			_enumerator = _task.GetEnumerator();
						
			onComplete = null;
		}
Exemplo n.º 3
0
        public SingleTask(IEnumerator enumerator)
        {
            if (enumerator is TaskCollection || enumerator is SingleTask)
                _enumerator = enumerator;
            else
            {
                _task = new SerialTaskCollection();

                _task.Add(enumerator);

                _enumerator = _task.GetEnumerator();
            }

            _onComplete = null;
        }
Exemplo n.º 4
0
	// Use this for initialization
	void Start () 
	{
		SerialTaskCollection st = new SerialTaskCollection();
		
		st.Add(Print(1));
		st.Add(Print(2));
		st.Add(DoSomethingAsynchonously(1));
		st.Add(Print(4));
		st.Add(DoSomethingAsynchonously(5));
		st.Add(Print(5));
		st.Add(WWWTest ());
		st.Add(Print(6));
		st.Add(Print(7));
		
		StartCoroutine(st.GetEnumerator());
	}
Exemplo n.º 5
0
        public void Setup()
        {
            serialTasks1 = new SerialTaskCollection();
            parallelTasks1 = new ParallelTaskCollection();
            serialTasks2 = new SerialTaskCollection();
            parallelTasks2 = new ParallelTaskCollection();

            task1 = new Task(15);
            task2 = new Task(5);

            iterable1 = new Enumerable(15);
            iterable2 = new Enumerable(5);

            iterations = 0;

            _taskRunner = TaskRunner.Instance;
        }
Exemplo n.º 6
0
	// Use this for initialization
	void Start () 
	{
		Application.targetFrameRate = 20;
		
		ParallelTaskCollection pt = new ParallelTaskCollection();
		SerialTaskCollection	st = new SerialTaskCollection();
		
		st.Add(Print("s1"));
		st.Add(DoSomethingAsynchonously());
		st.Add(Print("s3"));
		
		pt.Add(Print("1"));
		pt.Add(Print("2"));
		pt.Add(Print("3"));
		pt.Add(Print("4"));
		pt.Add(Print("5"));
		pt.Add(st);
		pt.Add(Print("6"));
		pt.Add(WWWTest ());
		pt.Add(Print("7"));
		pt.Add(Print("8"));
			
		StartCoroutine(pt.GetEnumerator());
	}