コード例 #1
0
        void CreateRenderGraph()
        {
            Dependency.Complete();
#if RENDERING_FORCE_DIRECT
            Assert.IsTrue(false, "Obsolete script define RENDERING_FORCE_DIRECT enabled. Use the RenderGraphConfig singleton to configure a render graph");
#endif
            if (!HasSingleton <RenderGraphConfig>())
            {
                Entity eConfig = GetSingletonEntity <DisplayInfo>();
                EntityManager.AddComponentData <RenderGraphConfig>(eConfig, RenderGraphConfig.Default);
            }

            RenderGraphConfig config = GetSingleton <RenderGraphConfig>();
            if (!config.Equals(currentConfig) || eMainViewNode == Entity.Null)
            {
                RenderDebug.LogAlways("RenderGraphConfig changed, building a new render graph!");
                DestroyRenderGraph();
                // we should run the bgfx system here once, so textures are cleaned up and ready for re-use
                currentConfig = config;
                // we only build a default graph if there are no existing nodes - otherwise assume they are already built
                eMainViewNode = BuildRenderGraph();
                CreateScreenToWorldChain(RenderPassType.Opaque, ScreenToWorldId.MainCamera);
                CreateScreenToWorldChain(RenderPassType.Sprites, ScreenToWorldId.Sprites);
                CreateScreenToWorldChain(RenderPassType.UI, ScreenToWorldId.UILayer);
            }

            // build light nodes for lights that have no node associated - need to do this always
            BuildAllLightNodes(eMainViewNode);
        }
コード例 #2
0
        protected override void OnUpdate()
        {
            Entities.WithAll <Translation, Simulated>().WithNone <WorldPosition_Sync>().ForEach((Entity entity) =>
            {
                EntityManager.AddComponentData(entity, new WorldPosition_Sync
                {
                    howImportantAreYou = 1000
                });
            }).WithStructuralChanges().Run();

            Entities.WithAll <Rotation, Simulated>().WithNone <WorldOrientation_Sync>().ForEach((Entity entity) =>
            {
                EntityManager.AddComponentData(entity, new WorldOrientation_Sync
                {
                    howImportantAreYou = 1000
                });
            }).WithStructuralChanges().Run();

            Entities.WithAll <global::Coherence.Generated.LocalUser, Simulated>().WithNone <LocalUser_Sync>().ForEach((Entity entity) =>
            {
                EntityManager.AddComponentData(entity, new LocalUser_Sync
                {
                    howImportantAreYou = 600
                });
            }).WithStructuralChanges().Run();

            Entities.WithAll <global::Coherence.Generated.WorldPositionQuery, Simulated>().WithNone <WorldPositionQuery_Sync>().ForEach((Entity entity) =>
            {
                EntityManager.AddComponentData(entity, new WorldPositionQuery_Sync
                {
                    howImportantAreYou = 600
                });
            }).WithStructuralChanges().Run();

            Entities.WithAll <global::Coherence.Generated.ArchetypeComponent, Simulated>().WithNone <ArchetypeComponent_Sync>().ForEach((Entity entity) =>
            {
                EntityManager.AddComponentData(entity, new ArchetypeComponent_Sync
                {
                    howImportantAreYou = 600
                });
            }).WithStructuralChanges().Run();

            Entities.WithAll <global::Coherence.Generated.Persistence, Simulated>().WithNone <Persistence_Sync>().ForEach((Entity entity) =>
            {
                EntityManager.AddComponentData(entity, new Persistence_Sync
                {
                    howImportantAreYou = 600
                });
            }).WithStructuralChanges().Run();

            Entities.WithAll <global::Coherence.Generated.Player, Simulated>().WithNone <Player_Sync>().ForEach((Entity entity) =>
            {
                EntityManager.AddComponentData(entity, new Player_Sync
                {
                    howImportantAreYou = 600
                });
            }).WithStructuralChanges().Run();

            Dependency.Complete();
        }
コード例 #3
0
    protected override void OnUpdate()
    {
        float et = Convert.ToSingle(Time.ElapsedTime);

        NativeArray <Unity.Mathematics.Random> randArray = World.GetExistingSystem <RandomSystem>().Randoms;

        Dependency = JobHandle.CombineDependencies(Dependency, World.GetExistingSystem <EndFramePhysicsSystem>().FinalJobHandle);

        Dependency = Entities.WithAll <AnimalTag>().ForEach((int nativeThreadIndex, ref AnimalMovementData movementData) =>
        {
            // If the interval is ending, set a new random direction and random update interval.
            if (et % movementData.updateInterval <= 0.009f)
            {
                Unity.Mathematics.Random randomInstance = randArray[nativeThreadIndex];

                float x = randomInstance.NextFloat(movementData.direction.x - 0.2f, movementData.direction.x + 0.2f);
                float y = randomInstance.NextFloat(movementData.direction.y - 0.1f, movementData.direction.y + 0.1f);
                float z = randomInstance.NextFloat(movementData.direction.z - 0.2f, movementData.direction.z + 0.2f);
                y       = math.clamp(y, -0.3f, 0.3f);
                movementData.targetDirection = math.normalize(new float3(x, y, z));

                movementData.updateInterval = randomInstance.NextInt(3, 10);

                randArray[nativeThreadIndex] = randomInstance;
            }
        }).Schedule(Dependency);

        Dependency.Complete();
    }
コード例 #4
0
        protected override void OnUpdate()
        {
            float layoutWidth  = GenericInformation.LayoutWidth;
            float layoutHeight = GenericInformation.LayoutHeight;
            float agentSize    = GenericInformation.AgentSize;

            Dependency = Entities.WithAll <AgentTag>().ForEach((ref Collision c, in Translation t) =>
            {
                if (t.Value.x < agentSize * 0.5f)
                {
                    c.Collided           = true;
                    c.CollisionDirection = new float3(-1.0f, 0.0f, 0.0f);
                }

                if (t.Value.x > layoutWidth - agentSize * 0.5f)
                {
                    c.Collided           = true;
                    c.CollisionDirection = new float3(1.0f, 0.0f, 0.0f);
                }

                if (t.Value.z < agentSize * 0.5f)
                {
                    c.Collided           = true;
                    c.CollisionDirection = new float3(0.0f, 0.0f, -1.0f);
                }

                if (t.Value.z > layoutHeight - agentSize * 0.5f)
                {
                    c.Collided           = true;
                    c.CollisionDirection = new float3(0.0f, 0.0f, 1.0f);
                }
            }).ScheduleParallel(Dependency);

            Dependency.Complete();
        }
コード例 #5
0
        protected override void OnUpdate()
        {
            var historyBuffer = new CollisionHistoryBuffer(1);

            Entities
            .WithAll <Translation>()
            .ForEach((Entity entity, int entityInQueryIndex) =>
            {
                historyBuffer.GetCollisionWorldFromTick(0, 0, out var world);
            }).Schedule();
            Assert.Throws <InvalidOperationException>(() =>
            {
                Dependency.Complete();
            }, "PhysicHistoryBuffer must be declared as ReadOnly if a job does not write to it");

            Entities
            .WithAll <Translation>()
            .WithoutBurst()
            //.WithReadOnly(historyBuffer)
            .ForEach((Entity entity, int entityInQueryIndex) =>
            {
                historyBuffer.GetCollisionWorldFromTick(0, 0, out var world);
            }).Schedule();
            Assert.DoesNotThrow(() =>
            {
                Dependency.Complete();
            });
            historyBuffer.Dispose();
        }
コード例 #6
0
            public void AddToBufferThroughGetBufferFromEntity_AddsValueToBuffer(Entity entity, ScheduleType scheduleType)
            {
                switch (scheduleType)
                {
                    case ScheduleType.Run:
                        Entities.ForEach((ref EcsTestDataEntity tde) =>
                        {
                            var bfe = GetBufferFromEntity<EcsIntElement>(false);
                            bfe[entity].Clear();
                            bfe[entity].Add(new EcsIntElement(){ Value = 2 });
                        }).Run();
                        break;
                    case ScheduleType.Schedule:
                        Entities.ForEach((ref EcsTestDataEntity tde) =>
                        {
                            var bfe = GetBufferFromEntity<EcsIntElement>(false);
                            bfe[entity].Clear();
                            bfe[entity].Add(new EcsIntElement(){ Value = 2 });
                        }).Schedule();
                        break;
                    case ScheduleType.ScheduleParallel:
                        Entities.ForEach((ref EcsTestDataEntity tde) =>
                        {
                            var bfe = GetBufferFromEntity<EcsIntElement>(false);
                            bfe[entity].Clear();
                            bfe[entity].Add(new EcsIntElement(){ Value = 2 });
                        }).ScheduleParallel();
                        break;
                }

                Dependency.Complete();
            }
コード例 #7
0
    protected override void OnUpdate()
    {
        EntityManager em = EntityManager;

        NativeList <int> endGame = new NativeList <int>(Allocator.TempJob);
        var endGameParallel      = endGame.AsParallelWriter();

        Dependency = Entities.ForEach((ref DynamicBuffer <CollisionResult> collisions, in EndTrigger trigger) =>
        {
            for (int i = 0; i < collisions.Length; i++)
            {
                if (em.HasComponent <Player>(collisions[i].other))
                {
                    endGame.Add(1);
                }
            }
        }).Schedule(Dependency);

        Dependency.Complete();

        if (endGame.Length > 0)
        {
            UnityEngine.SceneManagement.SceneManager.LoadScene("YouWon");
        }
        endGame.Dispose();
    }
    protected override void OnUpdate()
    {
        Entities.WithStructuralChanges().ForEach((Entity entity, int entityInQueryIndex,
                                                  in Spawner_FromEntity spawnerFromEntity, in LocalToWorld spawnerLocalToWorld) =>
        {
            Dependency.Complete();

            var spawnedCount    = spawnerFromEntity.CountX * spawnerFromEntity.CountY;
            var spawnedEntities =
                new NativeArray <Entity>(spawnedCount, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);

            EntityManager.Instantiate(spawnerFromEntity.Prefab, spawnedEntities);
            EntityManager.DestroyEntity(entity);

            var translationFromEntity    = GetComponentDataFromEntity <Translation>();
            var setSpawnedTranslationJob = new SetSpawnedTranslation
            {
                TranslationFromEntity = translationFromEntity,
                Entities     = spawnedEntities,
                LocalToWorld = spawnerLocalToWorld.Value,
                Stride       = spawnerFromEntity.CountX
            };
            Dependency = setSpawnedTranslationJob.Schedule(spawnedCount, 64, Dependency);
            Dependency = spawnedEntities.Dispose(Dependency);
        }).Run();
コード例 #9
0
        protected override void OnUpdate()
        {
            Dependency.Complete(); // #todo

            k_ProfileDeletedParents.Begin();
            UpdateParentWhoseChildrenRefIsRemoved();
            k_ProfileDeletedParents.End();

            k_ProfileChangeParents.Begin();
            ChildIsRemoved();
            k_ProfileChangeParents.End();

            k_ProfileChangeParents.Begin();
            ParentIsRemove();
            k_ProfileChangeParents.End();

            k_ProfileRemoveParents.Begin();
            UpdateChildWhoseParentRefIsRemoved();
            k_ProfileRemoveParents.End();

            k_ProfileNewParents.Begin();
            UpdateChildWhoseParentRefIsNew();
            k_ProfileNewParents.End();

            k_ProfileChangeParents.Begin();
            UpdateChildWhoseParentIsChanged();
            k_ProfileChangeParents.End();

            Dependency = new JobHandle();
        }
コード例 #10
0
    protected override void OnUpdate()
    {
        var commandBuffer = Barrier.CreateCommandBuffer().ToConcurrent();

        Dependency = Entities.ForEach((ref DynamicBuffer <DamageEvent> damageEvents, ref Health health) =>
        {
            for (int i = 0; i < damageEvents.Length; i++)
            {
                health.current -= damageEvents[i].damage;
            }
        }).ScheduleParallel(Dependency);

        Dependency.Complete();


        Dependency = Entities.ForEach((ref DynamicBuffer <DamageEvent> damageEvents) =>
        {
            damageEvents.Clear();
        }).ScheduleParallel(Dependency);

        Dependency.Complete();
        Dependency = Entities.ForEach((Entity entity, int entityInQueryIndex, in Health health) =>
        {
            if (health.current < 0)
            {
                commandBuffer.DestroyEntity(entityInQueryIndex, entity);
            }
        }).ScheduleParallel(Dependency);
        Barrier.AddJobHandleForProducer(Dependency);

        Dependency.Complete();
    }
コード例 #11
0
        /// <summary>
        /// Here is handled object visibility processing and filtering
        /// </summary>
        protected override void OnUpdate()
        {
            var entityQuery = GetEntityQuery(typeof(GeometryDataModels.Target));
            var planes      = new NativeArray <Plane>(6, Allocator.TempJob);

            planes.CopyFrom(GeoVision.Planes);
            var job2 = new CheckVisibility()
            {
                targets = entityQuery.ToComponentDataArray <GeometryDataModels.Target>(Allocator.TempJob),

                planes   = new NativeArray <Plane>(6, Allocator.TempJob),
                entities = entityQuery.ToEntityArray(Allocator.TempJob)
            };

            job2.planes.CopyFrom(planes);
            Dependency = job2.Schedule(job2.targets.Length, 6);
            Dependency.Complete();
            //Wait for job completion


            entityCommandBuffer.AddJobHandleForProducer(Dependency);
            entityQuery.CopyFromComponentDataArray <GeometryDataModels.Target>(job2.targets);

            lastCount = entityQuery.CalculateEntityCount();
            job2.planes.Dispose();
            job2.entities.Dispose();
            job2.targets.Dispose();
            planes.Dispose();
        }
コード例 #12
0
    protected override void OnUpdate()
    {
        float worldYKill = -25.0f;
        var   ecb        = ecbs.CreateCommandBuffer();

        var           ecbp = ecb.ToConcurrent();
        EntityManager em   = EntityManager;

        Dependency = Entities.ForEach((Entity e, int entityInQueryIndex, ref Translation t) => {
            if (t.Value.y <= worldYKill)
            {
                if (em.HasComponent <Player>(e))
                {
                    t.Value = new float3(0, 10, 0);
                    ecbp.SetComponent <Velocity>(entityInQueryIndex, e, new Velocity()
                    {
                        value = float3.zero
                    });
                }
                else
                {
                    ecbp.DestroyEntity(entityInQueryIndex, e);
                }
            }
        }).Schedule(Dependency);
        Dependency.Complete();
        ecbs.AddJobHandleForProducer(Dependency);
    }
コード例 #13
0
        protected override void OnUpdate()
        {
            Entities.WithAll <Simulated>().ForEach((Entity entity, DynamicBuffer <TransferAction> buffer) =>
            {
                if (buffer.Length == 0)
                {
                    return;
                }

                var transferAction = buffer[0];

                if (transferAction.accepted)
                {
                    EntityManager.RemoveComponent <Simulated>(entity);
                    EntityManager.RemoveComponent <LingerSimulated>(entity);
                    ReceiveUpdate.RemoveSyncComponents(EntityManager, entity);
                    ReceiveUpdate.AddCommandBuffers(EntityManager, entity);
                }

                if (transferAction.accepted && transferAction.participant == 0)
                {
                    EntityManager.AddComponent <Orphan>(entity);
                }

                buffer.Clear();
            }).WithStructuralChanges().Run();

            Dependency.Complete();
        }
コード例 #14
0
    protected override void OnUpdate()
    {
        Dependency.Complete();

        var numDynamicBodies = m_BuildPhysicsWorld.PhysicsWorld.NumDynamicBodies;

        NativeReference <int> numEvents = new NativeReference <int>(Allocator.Persistent);

        numEvents.Value = 0;

        var getNumTriggerEventsJob = new GetNumTriggerEvents
        {
            NumTriggerEvents = numEvents
        }.Schedule(m_StepPhysicsWorld.Simulation, default);

        var getNumCollisionEventsJob = new GetNumCollisionEvents
        {
            NumCollisionEvents = numEvents
        }.Schedule(m_StepPhysicsWorld.Simulation, getNumTriggerEventsJob);

        getNumCollisionEventsJob.Complete();

        // The test is set up in a way that there is one event for each dynamic body
        Assert.IsTrue(numEvents.Value == numDynamicBodies);

        numEvents.Dispose();
    }
コード例 #15
0
        protected override void OnUpdate()
        {
            var commandBuffer = commandBufferSystem.CreateCommandBuffer().AsParallelWriter();

            var queries    = EntityManager.CreateEntityQuery(typeof(WorldPositionQuery));
            var queryCount = queries.CalculateEntityCount();

            if (queryCount == 0)
            {
                return;
            }

            var queryPositions = new NativeArray <float3>(queryCount, Allocator.TempJob);

            Entities.ForEach((int entityInQueryIndex, in WorldPositionQuery query) =>
            {
                queryPositions[entityInQueryIndex] = query.position;
            }).ScheduleParallel();

            Dependency.Complete();             // The ForEach below will read from 'queryPositions'



            Dependency.Complete();
            queryPositions.Dispose();
        }
コード例 #16
0
ファイル: Shooting.cs プロジェクト: soulonefirst/BoomBam
{ protected override void OnUpdate()
  {
      var time           = Time.ElapsedTime;
      var screenOneThird = InputCatcherSetter.screenHight * 2 / 3;
      var sreenBottom    = -InputCatcherSetter.screenHight;
      var ETS            = EntityManager.GetBuffer <EntityToSpawnData>(GetSingletonEntity <EntityToSpawnData>());

      Entities
      .ForEach((ref AttackData attackPosition, in Translation translation) =>
        {
            if (attackPosition.attackPoint.x != 0 && time - attackPosition.lastAttackTime > attackPosition.fireRate)
            {
                var SD = new SpawnData();
                if (translation.Value.y <= sreenBottom + screenOneThird)
                {
                    SD.numPrefabToSpawn = 0;
                }
                else if (translation.Value.y <= sreenBottom + screenOneThird * 2)
                {
                    SD.numPrefabToSpawn = 1;
                }
                else
                {
                    SD.numPrefabToSpawn = 2;
                }
                SD.moveData = new MoveData {
                    startPosition = translation.Value, targetPosition = attackPosition.attackPoint, nonStop = 1
                };
                ETS.Add(SD);
                attackPosition.lastAttackTime = time;
            }
        }).Schedule();
      Dependency.Complete();
  }
コード例 #17
0
        protected override void OnUpdate()
        {
            UpdateSwipeInput();

            Direction direction;

            if (!TryGetKeyboardInput(out direction) && !TryGetTouchInput(out direction))
            {
                return;
            }

            EntityCommandBuffer commandBuffer = new EntityCommandBuffer(Allocator.TempJob);

            Entities
            .WithAll <Player, TurnToken>()
            .WithNone <ActorAction>()
            .ForEach((Entity entity) =>
            {
                commandBuffer.AddComponent(entity, new ActorAction(direction));
            }).Schedule();

            Dependency.Complete();

            commandBuffer.Playback(EntityManager);
            commandBuffer.Dispose();
        }
コード例 #18
0
    protected override void OnUpdate()
    {
        Dependency.Complete();
        Entities.WithStructuralChanges().ForEach((Entity entity, ref CartesianGridOnCubeGenerator cartesianGridOnCubeGenerator) =>
        {
            ref var floorPrefab  = ref cartesianGridOnCubeGenerator.Blob.Value.FloorPrefab;
            var wallPrefab       = cartesianGridOnCubeGenerator.Blob.Value.WallPrefab;
            var rowCount         = cartesianGridOnCubeGenerator.Blob.Value.RowCount;
            var wallSProbability = cartesianGridOnCubeGenerator.Blob.Value.WallSProbability;
            var wallWProbability = cartesianGridOnCubeGenerator.Blob.Value.WallWProbability;

            var floorPrefabCount = floorPrefab.Length;
            if (floorPrefabCount == 0)
            {
                return;
            }

            var cx = (rowCount * 0.5f);
            var cz = (rowCount * 0.5f);

            // 4 bits per grid section (bit:0=N,1=S,2=W,3=E)
            // One grid for each face.
            var gridWallsSize = 6 * (rowCount * (rowCount + 1) / 2);

            var blobBuilder = new BlobBuilder(Allocator.Temp);
            ref var cartesianGridOnCubeBlob = ref blobBuilder.ConstructRoot <CartesianGridOnCubeBlob>();
コード例 #19
0
            public void GetBufferOnOtherSystemInVar_GetsValueFromBuffer(Entity entity)
            {
                var otherSystem = new SystemBase_TestSystem();

                Entities.ForEach((ref EcsTestData td) => { td.value = otherSystem.GetBuffer <EcsIntElement>(entity)[0].Value; }).Schedule();
                Dependency.Complete();
            }
コード例 #20
0
            public void GetBufferOnOtherSystemInField_GetsValueFromBuffer(Entity entity)
            {
                var systemField = otherSystemField;

                Entities.ForEach((ref EcsTestData td) => { td.value = systemField.GetBuffer <EcsIntElement>(entity)[0].Value; }).Schedule();
                Dependency.Complete();
            }
コード例 #21
0
            public void SetComponent_SetsValue(Entity entity, ScheduleType scheduleType)
            {
                switch (scheduleType)
                {
                case ScheduleType.Run:
                    Entities.ForEach((ref EcsTestDataEntity tde) => { SetComponent(entity, new EcsTestData()
                        {
                            value = 2
                        }); }).Run();
                    break;

                case ScheduleType.Schedule:
                    Entities.ForEach((ref EcsTestDataEntity tde) => { SetComponent(entity, new EcsTestData()
                        {
                            value = 2
                        }); }).Schedule();
                    break;

                case ScheduleType.ScheduleParallel:
                    Entities.ForEach((ref EcsTestDataEntity tde) => { SetComponent(entity, new EcsTestData()
                        {
                            value = 2
                        }); }).ScheduleParallel();
                    break;
                }

                Dependency.Complete();
            }
コード例 #22
0
            public void GetComponentOnOtherSystemInField_GetsValue(Entity entity)
            {
                var systemField = otherSystemField;

                Entities.ForEach((ref EcsTestData td) => { td.value = systemField.GetComponent <EcsTestDataEntity>(entity).value0; }).Schedule();
                Dependency.Complete();
            }
コード例 #23
0
            public void GetComponentOnOtherSystemInVar_GetsValue(Entity entity)
            {
                var otherSystem = new SystemBase_TestSystem();

                Entities.ForEach((ref EcsTestData td) => { td.value = otherSystem.GetComponent <EcsTestDataEntity>(entity).value0; }).Schedule();
                Dependency.Complete();
            }
コード例 #24
0
        protected override void OnUpdate()
        {
            Dependency.Complete();
            var sys = World.GetExistingSystem <RendererBGFXSystem>().InstancePointer();

            if (!sys->m_initialized)
            {
                return;
            }
            // get all MeshRenderer, cull them, and add them to graph nodes that need them
            // any mesh renderer MUST have a shared component data that has a list of passes to render to
            // this list is usually very shared - all opaque meshes will render to all ZOnly and Opaque passes
            // this shared data is not dynamically updated - other systems are responsible to update them if needed
            // simple
            Entities.WithNone <DisableRendering>().WithAll <SimpleMeshRenderer>().WithoutBurst().ForEach((Entity e, ref MeshRenderer mr, ref LocalToWorld tx, in WorldBounds wb, in WorldBoundingSphere wbs) =>
            {
                if (!EntityManager.HasComponent <RenderToPasses>(e))
                {
                    return;
                }

                RenderToPasses toPassesRef = EntityManager.GetSharedComponentData <RenderToPasses>(e);
                DynamicBuffer <RenderToPassesEntry> toPasses = EntityManager.GetBufferRO <RenderToPassesEntry>(toPassesRef.e);
                for (int i = 0; i < toPasses.Length; i++)
                {
                    Entity ePass = toPasses[i].e;
                    var pass     = EntityManager.GetComponentData <RenderPass>(ePass);
                    if (Culling.Cull(in wbs, in pass.frustum) == Culling.CullingResult.Outside)
                    {
                        continue;
                    }
                    // double cull as example only
                    if (Culling.IsCulled(in wb, in pass.frustum))
                    {
                        continue;
                    }
                    var mesh   = EntityManager.GetComponentData <MeshBGFX>(mr.mesh);
                    uint depth = 0;
                    switch (pass.passType)
                    {
                    case RenderPassType.ShadowMap:
                        SubmitHelper.SubmitShadowMapMeshDirect(sys, pass.viewId, ref mesh, ref tx.Value, mr.startIndex, mr.indexCount, pass.GetFlipCullingInverse(), default);
                        break;

                    case RenderPassType.Transparent:
                        depth = pass.ComputeSortDepth(tx.Value.c3);
                        goto case RenderPassType.Opaque;

                    case RenderPassType.Opaque:
                        var material = EntityManager.GetComponentData <SimpleMaterialBGFX>(mr.material);
                        SubmitHelper.SubmitSimpleMeshDirect(sys, pass.viewId, ref mesh, ref tx.Value, ref material, mr.startIndex, mr.indexCount, pass.GetFlipCulling(), depth);
                        break;

                    default:
                        Assert.IsTrue(false);
                        break;
                    }
                }
            }).Run();
コード例 #25
0
 public void MultipleGetBuffers_GetsValuesFromBuffers()
 {
     Entities.ForEach((ref EcsTestDataEntity tde) =>
     {
         tde.value0 = GetBuffer <EcsIntElement>(tde.value1)[0].Value + GetBuffer <EcsIntElement>(tde.value1)[0].Value;
     }).Schedule();
     Dependency.Complete();
 }
コード例 #26
0
 public void MultipleGetComponents_GetsValues()
 {
     Entities.ForEach((ref EcsTestDataEntity tde) =>
     {
         tde.value0 = GetComponent <EcsTestData>(tde.value1).value + GetComponent <EcsTestData>(tde.value1).value;
     }).Schedule();
     Dependency.Complete();
 }
コード例 #27
0
 public void SetComponentInSchedule_SetsValue(Entity entity)
 {
     Entities.ForEach((ref EcsTestDataEntity tde) => { SetComponent <EcsTestData>(entity, new EcsTestData()
         {
             value = 2
         }); }).Schedule();
     Dependency.Complete();
 }
コード例 #28
0
            public void TestMe(NativeArray <int> myArray)
            {
                int capturedValue = 12;

                Job.WithCode(() =>
                {
                    SetValues(myArray, capturedValue);
                }).Schedule();
                Dependency.Complete();
            }
コード例 #29
0
 public void AddToDynamicBuffer()
 {
     Entities
     .ForEach((ref EcsTestData e1, ref DynamicBuffer <TestBufferElement> buf) =>
     {
         buf.Add(4);
     })
     .Schedule();
     Dependency.Complete();
 }
コード例 #30
0
            public void WithAllSharedComponentData()
            {
                int multiplier = 1;

                Entities
                .WithAll <EcsTestSharedComp>()
                .ForEach((ref EcsTestData e1) => { e1.value += multiplier; })
                .Schedule();
                Dependency.Complete();
            }