コード例 #1
0
ファイル: EntityStore.cs プロジェクト: dn9090/Checs
        public static void Construct(EntityStore *store)
        {
            store->version         = 1;
            store->capacity        = DefaultCapacity;
            store->count           = 0;
            store->entitiesInChunk = MemoryUtility.Malloc <EntityInChunk>(store->capacity);
            store->freeSlots       = FreeEntitySlotList.Empty();

            Unsafe.InitBlock(store->entitiesInChunk, 0, (uint)(sizeof(EntityInChunk) * store->capacity));
        }
コード例 #2
0
ファイル: EntityManager.cs プロジェクト: dn9090/Checs
        private void Construct()
        {
            // Revisit with threading (cache invalidation).
            byte *ptr = MemoryUtility.Malloc <byte>(
                sizeof(ArchetypeStore) +
                sizeof(EntityStore) +
                sizeof(EntityQueryCache));

            this.archetypeStore = (ArchetypeStore *)ptr;
            this.entityStore    = (EntityStore *)(ptr += sizeof(ArchetypeStore));
            this.queryCache     = (EntityQueryCache *)(ptr += sizeof(EntityStore));

            ArchetypeStore.Construct(this.archetypeStore);
            EntityStore.Construct(this.entityStore);
            EntityQueryCache.Construct(this.queryCache);
        }