Beispiel #1
0
    protected void Remove <T>() where T : struct
    {
        var cg  = GetComponentGroup(ComponentType.Create <T>());
        var ecb = new EntityCommandBuffer(Allocator.TempJob);

        ecbs.Add(ecb);
        var job = new RemoveJob <T>
        {
            entiType = GetArchetypeChunkEntityType(),
            ecb      = ecb.ToConcurrent(),
        }
        .Schedule(cg, input);

        jobHandles.Add(job);
    }
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var commandBufferSystem = World.GetExistingManager <BeginSimulationEntityCommandBufferSystem>();

            inputDeps = new ProcessJob
            {
                RemoveQueue = m_RemoveQueue.ToConcurrent()
            }.Schedule(this, inputDeps);

            inputDeps = new RemoveJob
            {
                RemoveQueue   = m_RemoveQueue,
                CommandBuffer = commandBufferSystem.CreateCommandBuffer()
            }.Schedule(inputDeps);

            commandBufferSystem.AddJobHandleForProducer(inputDeps);

            return(inputDeps);
        }
Beispiel #3
0
 protected virtual void RemoveJobCommand(RemoveJob removeJob)
 {
     try
     {
         var deleted = _scheduler.DeleteJob(removeJob.JobKey);
         if (deleted)
         {
             Context.Sender.Tell(new JobRemoved(removeJob.JobKey, removeJob.TriggerKey));
         }
         else
         {
             Context.Sender.Tell(new RemoveJobFail(removeJob.JobKey, removeJob.TriggerKey, new JobNotFoundException()));
         }
     }
     catch (Exception ex)
     {
         Context.Sender.Tell(new RemoveJobFail(removeJob.JobKey, removeJob.TriggerKey, ex));
     }
 }
Beispiel #4
0
        protected virtual void RemoveJobCommand(RemoveJob removeJob)
        {
            var sender = Context.Sender;

            ActorTaskScheduler.RunTask(async() =>
            {
                try
                {
                    var deleted = await Scheduler.DeleteJob(removeJob.JobKey);
                    if (deleted)
                    {
                        sender.Tell(new JobRemoved(removeJob.JobKey, removeJob.TriggerKey));
                    }
                    else
                    {
                        sender.Tell(new RemoveJobFail(removeJob.JobKey, removeJob.TriggerKey, new JobNotFoundException()));
                    }
                }
                catch (Exception ex)
                {
                    sender.Tell(new RemoveJobFail(removeJob.JobKey, removeJob.TriggerKey, ex));
                }
            });
        }