Esempio n. 1
0
        protected override void OnBeforeCreateManagerInternal(World world)
        {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            m_SystemID = World.AllocateSystemID();
#endif
            m_World         = world;
            m_EntityManager = world.GetOrCreateManager <EntityManager>();
            m_SafetyManager = m_EntityManager.ComponentJobSafetyManager;

            m_ComponentGroups = new ComponentGroup[0];
#if !UNITY_CSHARP_TINY
            m_CachedComponentGroupArrays = new ComponentGroupArrayStaticCache[0];
            m_AlwaysUpdateSystem         = GetType().GetCustomAttributes(typeof(AlwaysUpdateSystemAttribute), true).Length != 0;
#else
            m_AlwaysUpdateSystem = true;
#endif
            m_JobDependencyForReadingManagers = new NativeList <int>(10, Allocator.Persistent);
            m_JobDependencyForWritingManagers = new NativeList <int>(10, Allocator.Persistent);

#if !UNITY_ZEROPLAYER
            ComponentSystemInjection.Inject(this, world, m_EntityManager, out m_InjectedComponentGroups, out m_InjectFromEntityData);
            m_InjectFromEntityData.ExtractJobDependencyTypes(this);
#endif
            InjectNestedIJobProcessComponentDataJobs();

            UpdateInjectedComponentGroups();
        }
Esempio n. 2
0
        protected override void OnBeforeCreateManagerInternal(World world, int capacity)
        {
            m_World              = world;
            m_EntityManager      = world.GetOrCreateManager <EntityManager>();
            m_SafetyManager      = m_EntityManager.ComponentJobSafetyManager;
            m_AlwaysUpdateSystem = GetType().GetCustomAttributes(typeof(AlwaysUpdateSystemAttribute), true).Length != 0;

            m_ComponentGroups                 = new ComponentGroup[0];
            m_CachedComponentGroupArrays      = new ComponentGroupArrayStaticCache[0];
            m_JobDependencyForReadingManagers = new NativeList <int>(10, Allocator.Persistent);
            m_JobDependencyForWritingManagers = new NativeList <int>(10, Allocator.Persistent);

            ComponentSystemInjection.Inject(this, world, m_EntityManager, out m_InjectedComponentGroups, out m_InjectFromEntityData);
            m_InjectFromEntityData.ExtractJobDependencyTypes(this);

            UpdateInjectedComponentGroups();
        }
        public static void CreateInjection(FieldInfo field, EntityManager entityManager, List <InjectionData> componentDataFromEntity, List <InjectionData> fixedArrayFromEntity)
        {
            var isReadOnly = field.GetCustomAttributes(typeof(ReadOnlyAttribute), true).Length != 0;

            if (field.FieldType.IsGenericType && field.FieldType.GetGenericTypeDefinition() == typeof(ComponentDataFromEntity <>))
            {
                var injection = new InjectionData(field, field.FieldType.GetGenericArguments()[0], isReadOnly);
                componentDataFromEntity.Add(injection);
            }
            else if (field.FieldType.IsGenericType && field.FieldType.GetGenericTypeDefinition() == typeof(FixedArrayFromEntity <>))
            {
                var injection = new InjectionData(field, field.FieldType.GetGenericArguments()[0], isReadOnly);
                fixedArrayFromEntity.Add(injection);
            }
            else
            {
                ComponentSystemInjection.ThrowUnsupportedInjectException(field);
            }
        }
Esempio n. 4
0
 protected sealed override void OnBeforeCreateManagerInternal(World world)
 {
     base.OnBeforeCreateManagerInternal(world);
     this.m_BarrierList = ComponentSystemInjection.GetAllInjectedManagers <BarrierSystem>(this, world);
 }