Beispiel #1
0
        /// <summary>
        /// Called from the main thread when we want to check for the completetion of loadables.
        /// When a loadable is completed, this will finalize them; this blocks the main thread.
        /// </summary>
        public void Update()
        {
            if (m_completed)
            {
                return;
            }

            if (!m_started || !IsLoadCompleted)
            {
                return;
            }
            if (IsFinalizeSuccessful)
            {
                m_completed = true;
                return;
            }

            // finalize once per frame
            if (m_loadableEnumerator == null)
            {
                m_loadableEnumerator = m_loadables.Values.GetEnumerator();
            }

            var enumerator = m_loadableEnumerator.Value;

            if (enumerator.MoveNext())
            {
                LoadingTask current = enumerator.Current;
                current.DoFinalize();
            }
        }