Beispiel #1
0
        internal EntityManager(World world)
        {
            TypeManager.Initialize();

            m_World = world;

            m_ComponentJobSafetyManager =
                (ComponentJobSafetyManager *)UnsafeUtility.Malloc(sizeof(ComponentJobSafetyManager), 64,
                                                                  Allocator.Persistent);
            m_ComponentJobSafetyManager->OnCreate();

            m_EntityComponentStore  = Entities.EntityComponentStore.Create(world.SequenceNumber << 32);
            m_ManagedComponentStore = new ManagedComponentStore();
            m_EntityGroupManager    = new EntityGroupManager(m_ComponentJobSafetyManager);

            m_ExclusiveEntityTransaction = new ExclusiveEntityTransaction(EntityGroupManager,
                                                                          m_ManagedComponentStore, EntityComponentStore);

            m_UniversalQuery = CreateEntityQuery(
                new EntityQueryDesc
            {
                Options = EntityQueryOptions.IncludePrefab | EntityQueryOptions.IncludeDisabled
            }
                );
        }
Beispiel #2
0
 protected override unsafe void OnCreateManager()
 {
     TypeManager.Initialize();
     this.Entities = (EntityDataManager *)UnsafeUtility.Malloc((long)sizeof(EntityDataManager), 0x40, Allocator.Persistent);
     this.Entities.OnCreate();
     this.m_SharedComponentManager              = new SharedComponentDataManager();
     this.ArchetypeManager                      = new Unity.Entities.ArchetypeManager(this.m_SharedComponentManager);
     this.ComponentJobSafetyManager             = new Unity.Entities.ComponentJobSafetyManager();
     this.m_GroupManager                        = new EntityGroupManager(this.ComponentJobSafetyManager);
     this.m_ExclusiveEntityTransaction          = new ExclusiveEntityTransaction(this.ArchetypeManager, this.m_GroupManager, this.m_SharedComponentManager, this.Entities);
     this.m_CachedComponentTypeInArchetypeArray = (ComponentTypeInArchetype *)UnsafeUtility.Malloc((long)(sizeof(ComponentTypeInArchetype) * 0x400), 0x10, Allocator.Persistent);
 }
        internal EntityManager(World world)
        {
            TypeManager.Initialize();
            StructuralChange.Initialize();
            EntityCommandBuffer.Initialize();

            m_World = world;

            m_DependencyManager =
                (ComponentDependencyManager *)UnsafeUtility.Malloc(sizeof(ComponentDependencyManager), 64,
                                                                   Allocator.Persistent);
            m_DependencyManager->OnCreate();

            m_EntityComponentStore  = Entities.EntityComponentStore.Create(world.SequenceNumber << 32);
            m_EntityQueryManager    = Unity.Entities.EntityQueryManager.Create(m_DependencyManager);
            m_ManagedComponentStore = new ManagedComponentStore();

            m_EntityDataAccess = new EntityDataAccess(this, true);

            m_ExclusiveEntityTransaction = new ExclusiveEntityTransaction(this);

            m_UniversalQuery = CreateEntityQuery(
                new EntityQueryDesc
            {
                Options = EntityQueryOptions.IncludePrefab | EntityQueryOptions.IncludeDisabled
            }
                );

            m_UniversalQueryWithChunks = CreateEntityQuery(
                new EntityQueryDesc
            {
                All     = new[] { ComponentType.ReadWrite <ChunkHeader>() },
                Options = EntityQueryOptions.IncludeDisabled | EntityQueryOptions.IncludePrefab
            },
                new EntityQueryDesc
            {
                Options = EntityQueryOptions.IncludeDisabled | EntityQueryOptions.IncludePrefab
            }
                );

            #if ENABLE_UNITY_COLLECTIONS_CHECKS
            m_UniversalQuery._DisallowDisposing           = "EntityManager.UniversalQuery may not be disposed";
            m_UniversalQueryWithChunks._DisallowDisposing = "EntityManager.UniversalQuery may not be disposed";
            #endif
        }
        protected override void OnCreateManager(int capacity)
        {
            TypeManager.Initialize();

            m_Entities = (EntityDataManager *)UnsafeUtility.Malloc(sizeof(EntityDataManager), 64, Allocator.Persistent);
            m_Entities->OnCreate(capacity);

            m_SharedComponentManager = new SharedComponentDataManager();

            m_ArchetypeManager        = new ArchetypeManager(m_SharedComponentManager);
            ComponentJobSafetyManager = new ComponentJobSafetyManager();
            m_GroupManager            = new EntityGroupManager(ComponentJobSafetyManager);

            m_ExclusiveEntityTransaction = new ExclusiveEntityTransaction(m_ArchetypeManager, m_GroupManager, m_SharedComponentManager, m_Entities);

            m_CachedComponentTypeArray            = (ComponentType *)UnsafeUtility.Malloc(sizeof(ComponentType) * 32 * 1024, 16, Allocator.Persistent);
            m_CachedComponentTypeInArchetypeArray = (ComponentTypeInArchetype *)UnsafeUtility.Malloc(sizeof(ComponentTypeInArchetype) * 32 * 1024, 16, Allocator.Persistent);
        }
        internal EntityManager(World world)
        {
            TypeManager.Initialize();
            StructuralChange.Initialize();

            m_World = world;

            m_ComponentJobSafetyManager =
                (ComponentJobSafetyManager *)UnsafeUtility.Malloc(sizeof(ComponentJobSafetyManager), 64,
                                                                  Allocator.Persistent);
            m_ComponentJobSafetyManager->OnCreate();

            m_EntityComponentStore  = Entities.EntityComponentStore.Create(world.SequenceNumber << 32);
            m_ManagedComponentStore = new ManagedComponentStore();
            m_EntityQueryManager    = new EntityQueryManager(m_ComponentJobSafetyManager);
            m_EntityDataAccess      = new EntityDataAccess(this, true);

            m_ExclusiveEntityTransaction = new ExclusiveEntityTransaction(this);

            m_UniversalQuery = CreateEntityQuery(
                new EntityQueryDesc
            {
                Options = EntityQueryOptions.IncludePrefab | EntityQueryOptions.IncludeDisabled
            }
                );

            m_UniversalQueryWithChunks = CreateEntityQuery(
                new EntityQueryDesc
            {
                All     = new[] { ComponentType.ReadWrite <ChunkHeader>() },
                Options = EntityQueryOptions.IncludeDisabled | EntityQueryOptions.IncludePrefab
            },
                new EntityQueryDesc
            {
                Options = EntityQueryOptions.IncludeDisabled | EntityQueryOptions.IncludePrefab
            }
                );
        }