//called to add a task to the queue:
        public void Add(int taskID)
        {
            if (taskID < 0 || taskID >= tasksList.Count) //invalid task ID?
            {
                return;
            }

            tasksQueue.Add(taskID); //add the new task to the queue

            //if the task queue of the task launcher was empty
            if (tasksQueue.Count == 1)
            {
                StartNextTask();                                             //start the task instantly
            }
            tasksList[taskID].Launch();                                      //launch actual task

            CustomEvents.OnTaskLaunched(this, taskID, tasksQueue.Count - 1); //trigger custom delegate event
        }
Exemple #2
0
        //called to add a task to the queue:
        public void Add(int taskID)
        {
            if (taskID < 0 || taskID >= tasksList.Count) //invalid task ID?
            {
                return;
            }

            tasksQueue.Add(taskID); //add the new task to the queue

            //if the task queue of the task launcher was empty
            if (tasksQueue.Count == 1)
            {
                //set the timer:
                taskQueueTimer = tasksList[taskID].GetReloadTime();
            }

            tasksList[taskID].Launch();                                      //launch actual task

            CustomEvents.OnTaskLaunched(this, taskID, tasksQueue.Count - 1); //trigger custom delegate event
        }