public RoadLink ToRoadLink() { var link = new RoadLink(); link.neighbor = indexA; link.road = def; return(link); }
static EcsRoadLink CreateEcsRoadLink(RoadLink roadLink, RoadNetworkDescription rnd, NativeArray<Entity> roadEntities, NativeArray<Entity> junctionEntities) { Entity other; switch (roadLink.linkType) { case RoadLinkType.None: other = Entity.Null; break; case RoadLinkType.Junction: other = junctionEntities[rnd.GetJunctionIndexById(roadLink.nodeId)]; break; case RoadLinkType.Road: other = roadEntities[rnd.GetRoadIndexById(roadLink.nodeId)]; break; default: throw new NotSupportedException("Invalid RoadLinkType"); } return new EcsRoadLink { linkContactPoint = roadLink.contactPoint, roadLinkType = roadLink.linkType, linkedEntity = other }; }
// A Road shares a graph edge with another linked element if that element is a Road which is not part of // a set of junction roads private static bool IsLinkOnGraphEdge(RoadNetworkDescription roadNetwork, RoadLink link) { return(!(link.linkType == RoadLinkType.None || link.linkType == RoadLinkType.Junction || roadNetwork.GetRoadById(link.nodeId).junction != "-1")); }