Ejemplo n.º 1
0
        /// <summary>
        /// Waits for the given task to finish and removes it from the list.
        /// </summary>
        /// <param name="op">The task to finish</param>
        /// <returns>Whether or not the chunk needs to be remeshed.</returns>
        private bool FinishTask(BackgroundLoadChunkTask op)
        {
            if (op == null)
            {
                return(false);
            }

            m_Operations.Remove(op);
            op.Finish();

            return(op.RequiresRemesh);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads the given chunk in the current thread. If the chunk is already being loading
        /// in the background, this method will wait for the chunk to finish before continuing.
        /// </summary>
        /// <param name="chunk">The chunk to load.</param>
        /// <returns>Whether or not the chunk needs to be remeshed.</returns>
        internal bool LoadSync(Chunk chunk)
        {
            var oldOp = GetTask(chunk);

            if (oldOp != null)
            {
                oldOp.Finish();
                return(oldOp.RequiresRemesh);
            }

            var op = new BackgroundLoadChunkTask(chunk, m_ChunkLoadHandlers.ToArray());

            op.Finish();

            return(op.RequiresRemesh);
        }