Exemplo n.º 1
0
        protected override void OnUpdate()
        {
            EntityQuery entityQuery = GetEntityQuery(typeof(Translation), typeof(Tdata));

            quadrantHashMap.Clear();
            if (entityQuery.CalculateEntityCount() > quadrantHashMap.Capacity)
            {
                quadrantHashMap.Capacity = entityQuery.CalculateEntityCount();
            }

            var job = new SetHashMapJob()
            {
                quadrantHashMap = quadrantHashMap.AsParallelWriter(),
            };

            var handle = JobForEachExtensions.Schedule(job, entityQuery);

            handle.Complete();
        }
Exemplo n.º 2
0
        protected override void OnUpdate()
        {
            var job = new FighterJob()
            {
                targetMap = FightersHashMap.quadrantHashMap
            };
            var handle = job.Schedule(this);

            handle.Complete();
            var hJob = new HurtingJob()
            {
                targetMap     = FightersHashMap.quadrantHashMap,
                deltaTime     = Time.DeltaTime,
                commandBuffer = endSimulation.CreateCommandBuffer(),
            };
            var hHandle = hJob.Schedule(this);

            hHandle.Complete();

            EntityQuery entityQuery = GetEntityQuery(typeof(Fighter));

            hashMap.Clear();
            if (entityQuery.CalculateEntityCount() > hashMap.Capacity)
            {
                hashMap.Capacity = entityQuery.CalculateEntityCount();
            }

            var hashJob = new SetHashMapJob()
            {
                hashMap = hashMap.AsParallelWriter(),
            };

            var hashHandle = JobForEachExtensions.Schedule(hashJob, entityQuery);

            hashHandle.Complete();
        }