예제 #1
0
        /// <summary>
        /// Adds job to the queue.
        /// </summary>
        /// <param name="queueName">name of the queue</param>
        /// <param name="Instigator">object responsible for the fob</param>
        /// <param name="newDelegate"></param>
        /// <returns>true on success, false if queue doesn't exist</returns>
        public static bool AddJobToQueue(string queueName, GameObject Instigator, QueueSpotDelegate newDelegate)
        {
            Scheduler OutTmpQueue = null;

            if (Instance.Queues.TryGetValue(queueName, out OutTmpQueue))
            {
                return(OutTmpQueue.AddJobToQueue(Instigator, newDelegate));
            }

            else
            {
                Debug.Log("couldn't find queue");
                return(false);
            }
        }
예제 #2
0
        /// <summary>
        /// Adds a job to the queue
        /// </summary>
        /// <param name="Instigator">The object responsible for the job</param>
        /// <param name="newDelgate">The function to run</param>
        /// <returns></returns>
        public bool AddJobToQueue(GameObject Instigator, QueueSpotDelegate newDelgate)
        {
            if (Instigator == null)
            {
                return(false);
            }

            QueueSpot newSpot = new QueueSpot();

            newSpot.Execute    = newDelgate;
            newSpot.Instigator = Instigator;
            Queue.Add(newSpot);

            //update number of jobs per frame
            DetermineNumberOfJobs();

            if (!bIsRunning)
            {
                StartCoroutine(ProcessQueueRoutine());
            }
            return(true);
        }