C# Class TrafficManager.Traffic.TrafficPriority

Mostra file Open project: Katalyst6/CSL.TransitAddonMod Class Usage Examples

Public Properties

Property Type Description
PrioritySegments TrafficSegment[]
markedVehicles HashSet[]
maxStopVelocity float

Public Methods

Method Description
AddPrioritySegment ( ushort nodeId, ushort segmentId, SegmentEnd type ) : void
GetPrioritySegment ( ushort nodeId, ushort segmentId ) : SegmentEnd
GetPrioritySegmentIds ( ushort nodeId ) : List
GetSegmentDir ( int segment, ushort nodeid ) : Vector3
GetVehiclePosition ( ushort vehicleId ) : VehiclePosition
HasIncomingVehiclesWithHigherPriority ( ushort targetVehicleId, ushort nodeId ) : bool
IsLaneOrderConflictFree ( ushort segmentId, uint leftLaneIndex, uint rightLaneIndex ) : bool
IsLeftHandDrive ( ) : bool

Determines if the map uses a left-hand traffic system

IsLeftSegment ( ushort fromSegment, ushort toSegment, ushort nodeid ) : bool
IsPriorityNode ( ushort nodeId ) : bool
IsPrioritySegment ( ushort nodeId, ushort segmentId ) : bool
IsRightSegment ( ushort fromSegment, ushort toSegment, ushort nodeid ) : bool
RemovePrioritySegments ( ushort nodeId ) : void
TrafficLightSimulationStep ( ) : void
getPriorityNodes ( ) : HashSet
nodeHousekeeping ( ushort nodeId ) : void
segmentHousekeeping ( ushort segmentId ) : void

Protected Methods

Method Description
HasVehiclePriority ( bool debug, ushort targetCarId, bool targetIsOnMainRoad, ushort incomingCarId, bool incomingIsOnMainRoad, ushort nodeId ) : bool

Private Methods

Method Description
AddPriorityNode ( ushort nodeId ) : byte

Adds/Sets a node as a priority node

AddVehicle ( ushort vehicleId, VehiclePosition vehiclePos ) : void
ClearTraffic ( ) : void
HandleAllVehicles ( ) : void
InvertLeftRight ( Direction dir ) : Direction
MarkVehicleInSegment ( ushort vehicleId, ushort segmentId ) : void
OnLevelLoading ( ) : void
OnLevelUnloading ( ) : void
RemovePrioritySegment ( ushort nodeId, ushort segmentId ) : void
RemoveVehicleFromSegments ( ushort vehicleId ) : void
RequestClearTraffic ( ) : void
TrafficPriority ( ) : System
UnmarkVehicleInSegment ( ushort vehicleId, ushort segmentId ) : void
fixJunctions ( ) : void
isValidPriorityNode ( ushort nodeId, NodeValidityState &nodeState ) : bool
rebuildPriorityNodes ( ) : void

rebuilds the implicitly defined set of priority nodes (traffic light nodes & nodes with priority signs)

Method Details

AddPrioritySegment() public static method

public static AddPrioritySegment ( ushort nodeId, ushort segmentId, SegmentEnd type ) : void
nodeId ushort
segmentId ushort
type SegmentEnd
return void

GetPrioritySegment() public static method

public static GetPrioritySegment ( ushort nodeId, ushort segmentId ) : SegmentEnd
nodeId ushort
segmentId ushort
return SegmentEnd

GetPrioritySegmentIds() public static method

public static GetPrioritySegmentIds ( ushort nodeId ) : List
nodeId ushort
return List

GetSegmentDir() public static method

public static GetSegmentDir ( int segment, ushort nodeid ) : Vector3
segment int
nodeid ushort
return Vector3

GetVehiclePosition() public static method

public static GetVehiclePosition ( ushort vehicleId ) : VehiclePosition
vehicleId ushort
return VehiclePosition

HasIncomingVehiclesWithHigherPriority() public static method

public static HasIncomingVehiclesWithHigherPriority ( ushort targetVehicleId, ushort nodeId ) : bool
targetVehicleId ushort
nodeId ushort
return bool

HasVehiclePriority() protected static method

protected static HasVehiclePriority ( bool debug, ushort targetCarId, bool targetIsOnMainRoad, ushort incomingCarId, bool incomingIsOnMainRoad, ushort nodeId ) : bool
debug bool
targetCarId ushort
targetIsOnMainRoad bool
incomingCarId ushort
incomingIsOnMainRoad bool
nodeId ushort
return bool

IsLaneOrderConflictFree() public static method

public static IsLaneOrderConflictFree ( ushort segmentId, uint leftLaneIndex, uint rightLaneIndex ) : bool
segmentId ushort
leftLaneIndex uint
rightLaneIndex uint
return bool

IsLeftHandDrive() public static method

Determines if the map uses a left-hand traffic system
public static IsLeftHandDrive ( ) : bool
return bool

IsLeftSegment() public static method

public static IsLeftSegment ( ushort fromSegment, ushort toSegment, ushort nodeid ) : bool
fromSegment ushort
toSegment ushort
nodeid ushort
return bool

IsPriorityNode() public static method

public static IsPriorityNode ( ushort nodeId ) : bool
nodeId ushort
return bool

IsPrioritySegment() public static method

public static IsPrioritySegment ( ushort nodeId, ushort segmentId ) : bool
nodeId ushort
segmentId ushort
return bool

IsRightSegment() public static method

public static IsRightSegment ( ushort fromSegment, ushort toSegment, ushort nodeid ) : bool
fromSegment ushort
toSegment ushort
nodeid ushort
return bool

RemovePrioritySegments() public static method

public static RemovePrioritySegments ( ushort nodeId ) : void
nodeId ushort
return void

TrafficLightSimulationStep() public static method

public static TrafficLightSimulationStep ( ) : void
return void

getPriorityNodes() public static method

public static getPriorityNodes ( ) : HashSet
return HashSet

nodeHousekeeping() public static method

public static nodeHousekeeping ( ushort nodeId ) : void
nodeId ushort
return void

segmentHousekeeping() public static method

public static segmentHousekeeping ( ushort segmentId ) : void
segmentId ushort
return void

Property Details

PrioritySegments public_oe static_oe property

Dictionary of segments that are connected to roads with timed traffic lights or priority signs. Index: segment id
public static TrafficSegment[] PrioritySegments
return TrafficSegment[]

markedVehicles public_oe static_oe property

Markers that defined in which segment(s) a vehicle will be in the near future. Index: vehicle id
public static HashSet[] markedVehicles
return HashSet[]

maxStopVelocity public_oe static_oe property

public static float maxStopVelocity
return float