Beispiel #1
0
        protected override void OnUpdate()
        {
            var assetAuthoringArray = Query.ToComponentArray <RigBasedAssetAuthoring>();

            foreach (var assetAuthoring in assetAuthoringArray)
            {
                GameDebug.Log("Converting RigBasedAssetAuthoring GO:" + assetAuthoring.gameObject);

                var assetEntity = GetPrimaryEntity(assetAuthoring.gameObject);
                DstEntityManager.AddComponentData(assetEntity, new RigBasedAsset.Base());

                var rigComponent = assetAuthoring.GetComponent <RigComponent>();
                var rigDefSetup  = DstEntityManager.GetComponentData <RigDefinitionSetup>(assetEntity);

                ConvertSkinnedMeshRenderes(assetAuthoring, assetEntity, rigComponent);

                ConvertAttahments(assetAuthoring, assetEntity, rigComponent, rigDefSetup.Value);

                // TODO (mogensh) check that everything that is not deleted is either in attachment or skin

                // Delete skeleton bones
                foreach (var bone in assetAuthoring.Excluded)
                {
                    var boneEntity = GetPrimaryEntity(bone);
                    DstEntityManager.DestroyEntity(boneEntity);
                }
            }
        }
Beispiel #2
0
 protected override void OnUpdate()
 {
     Entities.ForEach((Transform transform) =>
     {
         var entity = GetPrimaryEntity(transform);
         if (DstEntityManager.HasComponent <Parent>(entity))
         {
             DstEntityManager.DestroyEntity(entity);
         }
     });
 }
Beispiel #3
0
        public void Replace_AfterCreatingAndDestroyingAllEntities()
        {
            DstEntityManager.CopyAndReplaceEntitiesFrom(SrcEntityManager);

            var emptyArchetype = DstEntityManager.CreateArchetype();

            DstEntityManager.CreateEntity(emptyArchetype, 10000);
            DstEntityManager.DestroyEntity(DstEntityManager.UniversalQuery);

            DstEntityManager.CopyAndReplaceEntitiesFrom(SrcEntityManager);
            Assert.AreEqual(0, DstEntityManager.UniversalQuery.CalculateChunkCount());
        }
        protected override void OnUpdate()
        {
            Entities.ForEach((VA_AnimationLibraryComponentAuthoring animationLib) =>
            {
                animationLib.animationLibrary.Init();

                // Blob builder to build.
                using (BlobBuilder blobBuilder = new BlobBuilder(Allocator.Temp))
                {
                    // Construct the root.
                    ref VA_AnimationLibraryData animationDataBlobAsset = ref blobBuilder.ConstructRoot <VA_AnimationLibraryData>();

                    // Set all the data.
                    BlobBuilderArray <VA_AnimationData> animationDataArray = blobBuilder.Allocate(ref animationDataBlobAsset.animations, animationLib.animationLibrary.animationData.Count);

                    for (int i = 0; i < animationDataArray.Length; i++)
                    {
                        // Copy data.
                        animationDataArray[i] = animationLib.animationLibrary.animationData[i];

                        if (animationLib.debugMode)
                        {
                            UnityEngine.Debug.Log("VA_AnimationLibrary added " + animationDataArray[i].name.ToString());
                        }
                    }

                    // Construct blob asset reference.
                    //BlobAssetReference<VA_AnimationLibraryData> animLibAssetRef = blobBuilder.CreateBlobAssetReference<VA_AnimationLibraryData>(Allocator.Persistent);
                    // Static because of multi scene setup.
                    animLibAssetRef = blobBuilder.CreateBlobAssetReference <VA_AnimationLibraryData>(Allocator.Persistent);

                    // Add it to the asset store.
                    BlobAssetStore.TryAdd(new Hash128(VA_AnimationLibraryUtils.AnimationLibraryAssetStoreName), animLibAssetRef);

                    if (animationLib.debugMode)
                    {
                        UnityEngine.Debug.Log("VA_AnimationLibrary has " + animLibAssetRef.Value.animations.Length.ToString() + " animations.");
                    }
                }

                // Remove the entity since we don't need it anymore.
                DstEntityManager.DestroyEntity(GetPrimaryEntity(animationLib));
            });