示例#1
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            int numberOfRequests = pathRequests.CalculateChunkCount();

            if (numberOfRequests == 0)
            {
                return(inputDeps);
            }

            //Schedule the findPath to build <Waypoints> Job
            FindPathJobChunk findPathJob = new FindPathJobChunk()
            {
                WaypointChunkBuffer        = GetArchetypeChunkBufferType <Waypoint>(false),
                PathRequestsChunkComponent = GetArchetypeChunkComponentType <PathRequest>(true),
                CellArray = RequiredExtensions.cells,
                TranslationsChunkComponent           = GetArchetypeChunkComponentType <Translation>(true),
                NavigationCapabilitiesChunkComponent = GetArchetypeChunkComponentType <NavigationCapabilities>(true),
                Neighbors     = neighbours,
                DimY          = worldSize.y,
                DimX          = worldSize.x,
                Iterations    = IterationLimit,
                NeighborCount = neighbours.Length
            };
            JobHandle jobHandle = findPathJob.Schedule(pathRequests, inputDeps);

            return(jobHandle);
        }
示例#2
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            int numberOfRequests = pathRequests.CalculateChunkCount();

            if (numberOfRequests == 0)
            {
                return(inputDeps);
            }

            //NativeArray<ArchetypeChunk> gridChunks = gridQuery.CreateArchetypeChunkArray(Allocator.TempJob);

            //Schedule the findPath to build <Waypoints> Job
            FindPathJobChunk findPathJob = new FindPathJobChunk()
            {
                WaypointChunkBuffer        = GetArchetypeChunkBufferType <Waypoint>(false),
                PathRequestsChunkComponent = GetArchetypeChunkComponentType <PathRequest>(true),
                //GridChunks = gridChunks,
                //CellTypeRO = GetArchetypeChunkBufferType<Cell>(true),
                CellArray = RequiredExtensions.cells,
                TranslationsChunkComponent           = GetArchetypeChunkComponentType <Translation>(true),
                NavigationCapabilitiesChunkComponent = GetArchetypeChunkComponentType <NavigationCapabilities>(true),
                Neighbors     = neighbours,
                DimY          = worldSize.y,
                DimX          = worldSize.x,
                Iterations    = IterationLimit,
                NeighborCount = neighbours.Length
            };
            JobHandle jobHandle = findPathJob.Schedule(pathRequests, inputDeps);

            //Schedule the remove <PathSearcher> Job
            //RemoveComponentJob removeComponentJob = new RemoveComponentJob()
            //{
            //    entityCommandBuffer = entityCommandBuffer.CreateCommandBuffer().ToConcurrent(),
            //    WaypointChunkBuffer = GetArchetypeChunkBufferType<Waypoint>(true),
            //    PathRequestsChunkComponent = GetArchetypeChunkComponentType<PathRequest>(true)

            //};
            //jobHandle = removeComponentJob.Schedule(pathRequests, jobHandle);

            //entityCommandBuffer.AddJobHandleForProducer(jobHandle);

            return(jobHandle);
        }