Game.Simulation.TransportPathfindSetup
Assembly:
Namespace: Game.Simulation
Type: struct
Base: (none)
Summary:
TransportPathfindSetup is a helper/utility struct used by the Pathfind setup system to collect and schedule jobs that prepare pathfinding targets for transport vehicles and taxis. It creates and schedules several Burst-compiled Jobs that scan transport-related entities (depots, vehicles, requests, route waypoints) and enqueue path targets into Pathfind seeker buffers so pathfinding can run for the correct entities. This struct holds EntityQuery handles, Component/Buffer type handles and lookups, and exposes public methods that schedule the jobs with updated handles.
Fields
-
private EntityQuery m_TransportVehicleQuery
Holds an EntityQuery used to iterate transport vehicle entities or transport depots when preparing transport vehicle targets. -
private EntityQuery m_TaxiQuery
EntityQuery used for taxi entities and taxi-related depots. -
private EntityQuery m_TransportVehicleRequestQuery
EntityQuery matching TransportVehicleRequest service requests (used to enqueue vehicle targets for requests). -
private EntityQuery m_TaxiRequestQuery
EntityQuery matching TaxiRequest service requests. -
private EntityTypeHandle m_EntityType
EntityTypeHandle updated against the system before scheduling jobs. -
private ComponentTypeHandle<PathOwner> m_PathOwnerType
Component type handle for PathOwner (read-only). -
private ComponentTypeHandle<Owner> m_OwnerType
Component type handle for Owner (read-only). -
private ComponentTypeHandle<Game.Objects.OutsideConnection> m_OutsideConnectionType
Component type handle for outside connection marker (read-only). -
private ComponentTypeHandle<ServiceRequest> m_ServiceRequestType
Component type handle for ServiceRequest (read-only). -
private ComponentTypeHandle<TransportVehicleRequest> m_TransportVehicleRequestType
Component type handle for TransportVehicleRequest (read-only). -
private ComponentTypeHandle<TaxiRequest> m_TaxiRequestType
Component type handle for TaxiRequest (read-only). -
private ComponentTypeHandle<Game.Buildings.TransportDepot> m_TransportDepotType
Component type handle for TransportDepot component (read-only). -
private ComponentTypeHandle<Game.Vehicles.CargoTransport> m_CargoTransportType
Component type handle for CargoTransport vehicle component (read-only). -
private ComponentTypeHandle<Game.Vehicles.PublicTransport> m_PublicTransportType
Component type handle for PublicTransport vehicle component (read-only). -
private ComponentTypeHandle<Game.Vehicles.Taxi> m_TaxiType
Component type handle for Taxi vehicle component (read-only). -
private ComponentTypeHandle<Controller> m_ControllerType
Component type handle for Controller component (read-only). -
private ComponentTypeHandle<Game.Routes.Color> m_RouteColorType
Component type handle for route color component (read-only). -
private ComponentTypeHandle<PrefabRef> m_PrefabRefType
Component type handle for PrefabRef (read-only). -
private BufferTypeHandle<PathElement> m_PathElementType
Buffer type handle for PathElement buffers (read-only). -
private BufferTypeHandle<ServiceDispatch> m_ServiceDispatchType
Buffer type handle for ServiceDispatch buffers (read-only). -
private BufferTypeHandle<LayoutElement> m_LayoutElementType
Buffer type handle for vehicle layout elements (read-only). -
private ComponentLookup<TransportVehicleRequest> m_TransportVehicleRequestData
Component lookup for random access to TransportVehicleRequest components. -
private ComponentLookup<TaxiRequest> m_TaxiRequestData
Component lookup for TaxiRequest components. -
private ComponentLookup<VehicleModel> m_VehicleModelData
Lookup for VehicleModel components (used when matching vehicle models to routes). -
private ComponentLookup<Game.Routes.Color> m_RouteColorData
Lookup for route color data (used to prefer same-colored vehicles/lines). -
private ComponentLookup<Game.Buildings.TransportDepot> m_TransportDepotData
Lookup for TransportDepot components (used to check flags like dispatch centers). -
private ComponentLookup<Game.Vehicles.CargoTransport> m_CargoTransportData
Lookup for CargoTransport data. -
private ComponentLookup<Game.Vehicles.PublicTransport> m_PublicTransportData
Lookup for PublicTransport data. -
private ComponentLookup<TransportLineData> m_TransportLineData
Lookup for TransportLineData (route metadata). -
private ComponentLookup<TransportDepotData> m_PrefabTransportDepotData
Lookup for TransportDepotData from prefabs (transport type info). -
private BufferLookup<ServiceDistrict> m_ServiceDistricts
Buffer lookup for service district buffers (used when filtering by district). -
private BufferLookup<RouteWaypoint> m_Waypoints
Buffer lookup for route waypoints; used to enqueue waypoint lane targets for routes.
Properties
- (none)
This struct does not expose public properties.
Constructors
public TransportPathfindSetup(PathfindSetupSystem system)
Initializes the TransportPathfindSetup instance. It creates the required EntityQueries and acquires ComponentTypeHandle/BufferTypeHandle/ComponentLookup/BufferLookup instances bound to the provided PathfindSetupSystem. This prepares the struct to update those handles prior to scheduling jobs.
Methods
-
public JobHandle SetupTransportVehicle(PathfindSetupSystem system, PathfindSetupSystem.SetupData setupData, JobHandle inputDeps)
Schedules the SetupTransportVehiclesJob across m_TransportVehicleQuery. The job scans transport depots or individual transport vehicles and enqueues path targets for transport vehicle seekers (both depot-driven and vehicle-driven scenarios). It updates internal type/lookups against the provided system first. Returns a JobHandle for the scheduled work. -
public JobHandle SetupTaxi(PathfindSetupSystem system, PathfindSetupSystem.SetupData setupData, JobHandle inputDeps)
Schedules the SetupTaxisJob across m_TaxiQuery. This job handles taxi-specific logic: matching taxi requests to depots or individual taxi vehicles, checking taxi flags, dispatch centers, service districts and enqueuing appropriate targets. Internal handles are updated before scheduling. -
public JobHandle SetupRouteWaypoints(PathfindSetupSystem system, PathfindSetupSystem.SetupData setupData, JobHandle inputDeps)
Schedules the SetupRouteWaypointsJob (IJobParallelFor) which iterates the setupData entries and, for each route entity, reads its route waypoint buffer and enqueues lane start targets for route seekers that have RouteLane component data for those waypoints. -
public JobHandle SetupTransportVehicleRequest(PathfindSetupSystem system, PathfindSetupSystem.SetupData setupData, JobHandle inputDeps)
Schedules the TransportVehicleRequestsJob across m_TransportVehicleRequestQuery. This job finds service requests for transport vehicles and enqueues suitable vehicle/waypoint targets if line/vehicle model/prefab compatibility checks pass. -
public JobHandle SetupTaxiRequest(PathfindSetupSystem system, PathfindSetupSystem.SetupData setupData, JobHandle inputDeps)
Schedules the TaxiRequestsJob across m_TaxiRequestQuery. This job matches taxi service requests to taxi seekers, sets up allowed path methods (Road/Boarding), checks district constraints, and enqueues targets accordingly. -
(Nested job types)
This struct defines several private nested Burst-compiled job types used by the above methods: - SetupTransportVehiclesJob : IJobChunk — core logic for transport depots and vehicles.
- SetupTaxisJob : IJobChunk — taxi-specific matching and enqueueing.
- SetupRouteWaypointsJob : IJobParallelFor — enqueues waypoint lane targets for routes.
- TransportVehicleRequestsJob : IJobChunk — processes TransportVehicleRequest service requests.
- TaxiRequestsJob : IJobChunk — processes TaxiRequest service requests. Each job uses ComponentTypeHandles, BufferLookups and ComponentLookups to perform efficient multi-threaded processing and interact with seeker buffers.
Usage Example
// Example: Called from a PathfindSetupSystem-like system.
// 'system' is the PathfindSetupSystem instance and 'setupData' is a populated SetupData.
var transportSetup = new TransportPathfindSetup(system);
// Schedule jobs that populate path targets for transport vehicles and taxis.
// inputDeps is the dependency handle from previous work in the system.
JobHandle deps = inputDeps;
// Schedule transport vehicle setup
deps = transportSetup.SetupTransportVehicle(system, setupData, deps);
// Schedule taxi setup
deps = transportSetup.SetupTaxi(system, setupData, deps);
// Schedule route waypoint population
deps = transportSetup.SetupRouteWaypoints(system, setupData, deps);
// Schedule requests processing
deps = transportSetup.SetupTransportVehicleRequest(system, setupData, deps);
deps = transportSetup.SetupTaxiRequest(system, setupData, deps);
// Ensure completion or combine with other work as required by the system:
deps.Complete();
Notes: - Each public scheduling method updates the stored type/lookup handles against the provided system before scheduling the corresponding job. - The jobs are Burst-compiled and designed to run in parallel where appropriate; callers should manage JobHandle dependencies correctly within the PathfindSetupSystem.