// OnUpdate runs on the main thread. protected override JobHandle OnUpdate(JobHandle inputDependencies) { var job = new RotationSpeedJob { DeltaTime = Time.deltaTime }; return(job.Schedule(this, inputDependencies)); }
protected override JobHandle OnUpdate(JobHandle inputDependencies) { var job = new RotationSpeedJob() { RotationType = GetArchetypeChunkComponentType <Rotation>(false), RotationSpeedType = GetArchetypeChunkComponentType <RotationSpeed>(true), DeltaTime = Time.DeltaTime }; return(job.Schedule(m_Query, inputDependencies)); }
// OnUpdate runs on the main thread. protected override JobHandle OnUpdate(JobHandle inputDependencies) { var job = new RotationSpeedJob() { DeltaTime = Time.deltaTime, rightDeplacement = Input.GetKey(KeyCode.RightArrow), leftDeplacement = Input.GetKey(KeyCode.LeftArrow), forwardDeplacement = Input.GetKey(KeyCode.UpArrow), backDeplacement = Input.GetKey(KeyCode.DownArrow), }; return(job.Schedule(this, inputDependencies)); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { ArchetypeChunkComponentType <Rotation> rotationType = GetArchetypeChunkComponentType <Rotation>(); ArchetypeChunkComponentType <RotationSpeed> rotationSpeedType = GetArchetypeChunkComponentType <RotationSpeed>(true); var job = new RotationSpeedJob { DeltaTime = Time.deltaTime, RotationType = rotationType, RotationSpeedType = rotationSpeedType }; return(job.Schedule(_group, inputDeps)); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var rotationType = GetArchetypeChunkComponentType <Rotation>(); var rotationSpeedType = GetArchetypeChunkComponentType <RotationSpeedComponent>(); var job = new RotationSpeedJob() { DeltaTime = Time.DeltaTime, RotationType = rotationType, RotationSpeedComponentType = rotationSpeedType }; return(job.Schedule(entityQuery, inputDeps)); }
//同样这个OnUpdate方法还是在主线程执行的 protected override JobHandle OnUpdate(JobHandle inputDependencies) { var rotationType = GetArchetypeChunkComponentType <Rotation>(); //可读写组件块 var rotationSpeedType = GetArchetypeChunkComponentType <RotationSpeed_IJobChunk>(true); //参数表示是否只读,默认是false,这个这个RotationSpeed_IJobChunk组件只是数据配置组件,不需要修改,所以参数为只读 true //实例化出JobChunk对象 var job = new RotationSpeedJob() { RotationType = rotationType, RotationSpeedType = rotationSpeedType, DeltaTime = Time.DeltaTime }; //将job提上日程 return(job.Schedule(m_Group, inputDependencies)); }
// OnUpdate runs on the main thread. protected override JobHandle OnUpdate(JobHandle inputDependencies) { // Explicitly declare: // - Read-Write access to Rotation // - Read-Only access to RotationSpeed_IJobChunk var rotationType = GetArchetypeChunkComponentType <Rotation>(); var rotationSpeedType = GetArchetypeChunkComponentType <RotationSpeed_IJobChunk>(true); var job = new RotationSpeedJob() { RotationType = rotationType, RotationSpeedType = rotationSpeedType, DeltaTime = Time.DeltaTime }; return(job.Schedule(m_Group, inputDependencies)); }
// OnUpdate runs on the main thread. protected override void OnUpdate() { // Explicitly declare: // - Read-Write access to Rotation // - Read-Only access to RotationSpeed_IJobChunk var rotationType = GetArchetypeChunkComponentType <Rotation>(); var rotationSpeedType = GetArchetypeChunkComponentType <RotationSpeed_IJobChunk>(true); var job = new RotationSpeedJob() { RotationType = rotationType, RotationSpeedType = rotationSpeedType, DeltaTime = Time.DeltaTime }; Dependency = job.Schedule(m_Group, Dependency); }