Exemplo n.º 1
0
        public virtual void Update(long millisecondsSinceLastUpdate, Utility.SimpleTaskProcessor taskProcessor)
        {
            while (!m_processingList.IsEmpty)
            {
                Action workUnit = null;
                if (m_processingList.TryDequeue(out workUnit))
                {
                    workUnit();
                }
            }

            if (Managers.GameStateManager.CurrentManager.IsAsynEnabled)
            {
                List<Task> childUpdates = new List<Task>();

                foreach (var child in Children)
                {
                    taskProcessor.EnqueueWork( () =>
                    {
                        child.Update(millisecondsSinceLastUpdate, taskProcessor);
                    });
                }
            }
            else
            {
                foreach (var child in Children)
                {
                    child.Update(millisecondsSinceLastUpdate, taskProcessor);
                }
            }
        }