Exemplo n.º 1
0
        public void Execute(ArchetypeChunk batchInChunk, int batchIndex)
        {
            var persistenceStateArray = batchInChunk.GetNativeArray(PersistenceStateType);
            var entityArray           = batchInChunk.GetNativeArray(EntityType);
            var inputDataSubArray     = RawContainerData.GetSubArray(SubArrayOffset, SubArrayByteSize);

            if (batchInChunk.Has(ComponentTypeHandle))
            {
                if (TypeSize > 0)
                {
                    var byteArray = batchInChunk.GetComponentDataAsByteArray(ComponentTypeHandle);
                    Execute(inputDataSubArray, TypeSize, byteArray, persistenceStateArray);
                }

                RemoveComponent.Execute(inputDataSubArray, ComponentType, TypeSize, entityArray, persistenceStateArray, Ecb, batchIndex);
            }
            else
            {
                AddMissingComponent.Execute(inputDataSubArray, ComponentType, TypeSize, entityArray, persistenceStateArray, Ecb, batchIndex);
            }
        }
Exemplo n.º 2
0
        public void Execute(ArchetypeChunk batchInChunk, int batchIndex)
        {
            var persistenceStateArray = batchInChunk.GetNativeArray(PersistenceStateType);
            var outputDataSubArray    = RawContainerData.GetSubArray(SubArrayOffset, SubArrayByteSize);

            if (batchInChunk.Has(ComponentTypeHandle))
            {
                if (TypeSize > 0)
                {
                    var byteArray = batchInChunk.GetComponentDataAsByteArray(ComponentTypeHandle);
                    // This execute method also updates meta data
                    Execute(outputDataSubArray, TypeSize, byteArray, persistenceStateArray);
                }
                else
                {
                    UpdateMetaDataForComponent.Execute(outputDataSubArray, TypeSize + PersistenceMetaData.SizeOfStruct, persistenceStateArray, 1);
                }
            }
            else
            {
                UpdateMetaDataForComponent.Execute(outputDataSubArray, TypeSize + PersistenceMetaData.SizeOfStruct, persistenceStateArray, 0);
            }
        }