Esempio n. 1
0
        private LinkedListNode <SingleTask> GetPoolNode(SingleTask value)
        {
            LinkedListNode <SingleTask> node = SuperInvokePoolHolder.PoolManager.GetInstance <LinkedListNode <SingleTask> >();

            node.Value = value;
            return(node);
        }
Esempio n. 2
0
        public static SingleTask MakeInstance(Action method, float delayTime, string groupTag)
        {
            SingleTask singleTask = SuperInvokePoolSettings.PoolManager.GetInstance <SingleTask>();

            singleTask.SetTask(method, delayTime);

            if (groupTag != null)
            {
                singleTask.groupTag = SuperInvokeTag.GetInstance(groupTag);
            }

            return(singleTask);
        }
Esempio n. 3
0
        public void InvokeTask()
        {
            float      lastTriggerTime = GetTriggerTime();
            SingleTask task            = node.Value;

            bool invokeRepeatCompleteAction = false;

            if (node == tasks.Last)  //last node

            //Continue after last node in these cases:
            // - infite loops
            // - limited loops but with avaible cycle yet
            //Else
            // - execution ended
            {
                if (iterativeMode && (!repeatSettings.thereIsIterationLimit || cycleCount < repeatSettings.repeats))
                {
                    cycleCount++;
                    node = tasks.First;
                    SetTriggerTime(lastTriggerTime);
                }
                else
                {
                    noMoreTasks = true;
                }

                invokeRepeatCompleteAction = iterativeMode;
            }
            else
            {
                node = node.Next;
                SetTriggerTime(lastTriggerTime);
            }

            task.InvokeTask();

            if (invokeRepeatCompleteAction)
            {
                jobRepeat.CompletedRepeatsNumber++;

                if (!jobRepeat.IsKilled())
                {
                    jobRepeat.OnRepeatCompleteAction.Invoke();
                }
            }
        }
Esempio n. 4
0
 public void AddSingleTask(SingleTask task)
 {
     tasks.AddLast(GetPoolNode(task));
 }
Esempio n. 5
0
 public void AddSingleTask(SingleTask task)
 {
     tasks.AddLast(task);
 }