protected override JobHandle OnUpdate(JobHandle inputDeps)
            {
                var job = new UpdateMovementTargetPos {
                    Movements = movementGroup.GetComponentDataArray <MovementData>(),
                    Positions = movementGroup.GetComponentDataArray <Position>(),
                    deltaTime = Time.deltaTime
                };

                Utils.Utils.ScheduleBatchedJobAndComplete(job.Schedule(movementGroup.GetComponentDataArray <Position>().Length, 32, inputDeps));
                return(inputDeps);
            }
Exemplo n.º 2
0
            protected override JobHandle OnUpdate(JobHandle inputDeps)
            {
                var neuralNetworks = new List <NeuralNetworkComponentData>(20);

                EntityManager.GetAllUniqueSharedComponentData(neuralNetworks);
                for (int i = 0, length = neuralNetworks.Count; i < length; ++i)
                {
                    var neuralNetwork = neuralNetworks[i];
                    neuralNetworkGroup.SetFilter(neuralNetwork);
                    var movements = neuralNetworkGroup.GetComponentDataArray <MovementData>();
                    if (movements.Length != 0)
                    {
                        var job = new UpdateMovementTargetPos {
                            Movements     = movements,
                            Positions     = neuralNetworkGroup.GetComponentDataArray <Position>(),
                            NeuralNetwork = neuralNetwork,
                            IDs           = neuralNetworkGroup.GetComponentDataArray <NeuralNetworkIDComponentData>()
                        };
                        Utils.Utils.ScheduleBatchedJobAndComplete(job.Schedule(movements.Length, 32, inputDeps));
                    }
                }
                return(inputDeps);
            }