private IEnumerator Operate() { var movementJob = new DroneMovementJob(); while (true) { if (_transforms.length == 0) { yield return(null); } var j = 0; foreach (var dataSource in Drones.Values) { var drone = (Drone)dataSource; drone.PreviousPosition = drone.transform.position; _movementInfoArray[j] = drone.GetMovementInfo(); j++; } movementJob.NextMove = _movementInfoArray; movementJob.DeltaTime = _time.Timer(); _time.Now(); _movementJobHandle = movementJob.Schedule(_transforms); yield return(null); _movementJobHandle.Complete(); } }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var job = new DroneMovementJob { Delta = _watch.ElapsedMilliseconds * 0.001f * _time.SpeedFactor }; _watch.Restart(); return(job.Schedule(this, inputDeps)); }