Exemplo n.º 1
0
        protected override JobHandle Tick(JobHandle inputDeps)
        {
            var a = GetComponentDataFromEntity <ParentGameplayEffectEntity>();

            inputDeps = new TickJob
            {
                Ecb = m_EntityCommandBuffer.CreateCommandBuffer().ToConcurrent()
            }.Schedule(this, inputDeps);
            return(inputDeps);
        }
Exemplo n.º 2
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            inputDeps = new TickJob()
            {
                DeltaTime = Time.DeltaTime
            }.Schedule(this, inputDeps);

            inputDeps = Tick(inputDeps);

            inputDeps = new TickResetJob {
            }.Schedule(this, inputDeps);

            m_EntityCommandBuffer.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
Exemplo n.º 3
0
            protected override JobHandle OnUpdate(JobHandle inputDeps)
            {
                _blackboardDataQueryList.Clear();
                _blackboardDataQueryIndices.Clear();
                EntityManager.GetAllUniqueSharedComponentData(_blackboardDataQueryList, _blackboardDataQueryIndices);

                var jobHandler = new JobHandle();

                for (var i = 0; i < _blackboardDataQueryList.Count; i++)
                {
                    var query = _blackboardDataQueryList[i];
                    if (query.Value == null)
                    {
                        continue;
                    }

                    var sharedIndex = _blackboardDataQueryIndices[i];

                    // TODO: avoid GC? use NativeArray?
                    var jobQuery = GetEntityQuery(query.Value
                                                  .Append(ComponentType.ReadOnly <BlackboardDataQuery>())
                                                  .Append(ComponentType.ReadOnly <NodeBlobRef>())
                                                  .Append(ComponentType.Exclude <RunOnMainThreadTag>())
                                                  .Append(ComponentType.Exclude <ForceRunOnMainThreadTag>())
                                                  .ToArray()
                                                  );

                    var job = new TickJob {
                        BlackboardDataQueryIndex = sharedIndex
                        , Blackboard             = new EntityJobChunkBlackboard {
                            GlobalSystemVersion = EntityManager.GlobalSystemVersion
                        }
                        , BlackboardDataQueryType = GetArchetypeChunkSharedComponentType <BlackboardDataQuery>()
                        , NodeBlobRefType         = GetArchetypeChunkComponentType <NodeBlobRef>()
                                                    // , EntityType = GetArchetypeChunkEntityType()
                    };

                    jobHandler = JobHandle.CombineDependencies(job.Schedule(jobQuery, inputDeps), jobHandler);
                }
                return(jobHandler);
            }