예제 #1
0
        internal unsafe void AddEntityComponentTypeCommand(EntityCommandBufferChain *chain, int jobIndex, ECBCommand op, Entity e, ComponentType t)
        {
            int size = Align(sizeof(EntityComponentCommand), 8);
            EntityComponentCommand *commandPtr = (EntityComponentCommand *)ref this.Reserve(chain, jobIndex, size);

            commandPtr->Header.Header.CommandType = (int)op;
            commandPtr->Header.Header.TotalSize   = size;
            commandPtr->Header.Header.SortIndex   = chain.m_LastSortIndex;
            commandPtr->Header.Entity             = e;
            commandPtr->ComponentTypeIndex        = t.TypeIndex;
        }
예제 #2
0
        internal unsafe void AddEntityComponentCommand <T>(EntityCommandBufferChain *chain, int jobIndex, ECBCommand op, Entity e, T component) where T : struct
        {
            int num2 = UnsafeUtility.SizeOf <T>();
            int size = Align(sizeof(EntityComponentCommand) + num2, 8);
            EntityComponentCommand *commandPtr = (EntityComponentCommand *)this.Reserve(chain, jobIndex, size);

            commandPtr->Header.Header.CommandType = (int)op;
            commandPtr->Header.Header.TotalSize   = size;
            commandPtr->Header.Header.SortIndex   = chain.m_LastSortIndex;
            commandPtr->Header.Entity             = e;
            commandPtr->ComponentTypeIndex        = TypeManager.GetTypeIndex <T>();
            commandPtr->ComponentSize             = num2;
            UnsafeUtility.CopyStructureToPtr <T>(ref component, (void *)(commandPtr + 1));
        }