Exemple #1
0
 public void RemoveJob(TweenJob job)
 {
     if (job != null)
     {
         RemoveJob(job.JobID);
     }
 }
Exemple #2
0
        private void Update()
        {
            if (JobsQueue.Count == 0 && TempJobsQueue.Count == 0)
            {
                return;
            }

            //Taking the jobs one by one as long as we have any jobs
            if (JobsQueue.Count == 0 && TempJobsQueue.Count > 0)
            {
                jobsQueue = new List <TweenJob>(TempJobsQueue);
                TempJobsQueue.Clear();
            }

            while (JobsQueue.Count > 0)
            {
                currentJob = JobsQueue[0];
                JobsQueue.RemoveAt(0);
                if (currentJob == null)
                {
                    continue;
                }

                TempJobsQueue.Add(currentJob);
                currentJob.Work(Time.deltaTime, this);
                currentJob = null;
            }
        }
Exemple #3
0
        public void AddJob(TweenJob job)
        {
            if (job == null)
            {
                return;
            }

            JobsQueue.Add(job);
        }
Exemple #4
0
        public TweenJob GetJob(int id)
        {
            TweenJob job = JobsQueue.Find(x => x.JobID == id); // look for the job in the active queue

            if (job != null)
            {
                return(job);
            }
            job = TempJobsQueue.Find(x => x.JobID == id); // look in the temp as well
            return(job);
        }
Exemple #5
0
        public bool EndJob(int id)
        {
            TweenJob job = GetJob(id);

            if (job == null)
            {
                return(false);
            }
            job.EndJob();
            RemoveJob(job.JobID);
            return(true);
        }
Exemple #6
0
        public void RemoveJob(int id)
        {
            TweenJob job = JobsQueue.Find(x => x.JobID == id); // look for the job in the active queue

            if (job != null)
            {
                JobsQueue.Remove(job);
            }

            job = TempJobsQueue.Find(x => x.JobID == id); // look in the temp as well
            if (job != null)
            {
                TempJobsQueue.Remove(job);
            }
        }