Exemplo n.º 1
0
        /// <summary>
        ///     Creates an array with all the chunks in this ComponentGroup.
        ///     Gives the caller a job handle so it can wait for GatherChunks to finish.
        /// </summary>
        /// <param name="allocator">Allocator to use for the array.</param>
        /// <param name="jobhandle">Handle to the GatherChunks job used to fill the output array.</param>
        /// <returns>NativeArray of all the chunks in this ComponentChunkIterator.</returns>
        public NativeArray <ArchetypeChunk> CreateArchetypeChunkArray(Allocator allocator, out JobHandle jobhandle)
        {
            JobHandle dependency = default(JobHandle);

            if (m_Filter.Type == FilterType.Changed)
            {
                var filterCount = m_Filter.Changed.Count;
                var readerTypes = stackalloc int[filterCount];

                fixed(int *indexInComponentGroupPtr = m_Filter.Changed.IndexInComponentGroup)
                for (int i = 0; i < filterCount; ++i)
                {
                    readerTypes[i] = m_GroupData->RequiredComponents[indexInComponentGroupPtr[i]].TypeIndex;
                }

                dependency = m_SafetyManager.GetDependency(readerTypes, filterCount, null, 0);
            }

            return(ComponentChunkIterator.CreateArchetypeChunkArray(m_GroupData->MatchingArchetypes, allocator, out jobhandle, ref m_Filter, dependency));
        }
Exemplo n.º 2
0
 internal JobHandle GetDependency(ComponentJobSafetyManager safetyManager)
 {
     return(safetyManager.GetDependency(m_GroupData->ReaderTypes, m_GroupData->ReaderTypesCount,
                                        m_GroupData->WriterTypes, m_GroupData->WriterTypesCount));
 }
Exemplo n.º 3
0
 public JobHandle GetDependency()
 {
     return(m_SafetyManager.GetDependency(m_GroupData->ReaderTypes, m_GroupData->ReaderTypesCount,
                                          m_GroupData->WriterTypes, m_GroupData->WriterTypesCount));
 }