protected override void OnUpdate()
        {
            if (Time.ElapsedTime > _nextUpdate)
            {
                AwaitingNavmeshText.text = $"Awaiting Path: {_navQuery.PendingCount} people";
                CachedPathText.text      = $"Cached Paths: {_navQuery.CachedCount}";
                _nextUpdate = (float)Time.ElapsedTime + 0.5f;
            }

            var entityCnt = _agentQuery.CalculateEntityCount();
            var entities  = _agentQuery.ToEntityArray(Allocator.TempJob);

            var inputDeps = new DetectIdleAgentJob
            {
                Entities  = entities,
                Agents    = GetComponentDataFromEntity <NavAgent>(),
                NeedsPath = _needsPath.AsParallelWriter()
            }.Schedule(entityCnt, 64);

            inputDeps = new SetNextPathJob
            {
                NeedsPath = _needsPath
            }.Schedule(inputDeps);
            inputDeps.Complete();
        }
Example #2
0
        protected override void OnUpdate()
        {
            if (Time.time > _nextUpdate)
            {
                AwaitingNavmeshText.text = $"Awaiting Path: {navQuery.PendingCount} people";
                CachedPathText.text      = $"Cached Paths: {navQuery.CachedCount}";
                _nextUpdate = Time.time + 0.5f;
            }
            var inputDeps = new DetectIdleAgentJob {
                data = data, needsPath = needsPath.ToConcurrent()
            }.Schedule(data.Length, 64);

            inputDeps = new SetNextPathJob {
                data = data, needsPath = needsPath
            }.Schedule(inputDeps);
            inputDeps.Complete();
        }