void GetEdgePosition(MarkupPoint.LocationType location, float offset, out Vector3 position, out Vector3 direction) { float lineShift; switch (location) { case MarkupPoint.LocationType.LeftEdge: RightLane.NetLane.CalculatePositionAndDirection(Enter.T, out position, out direction); lineShift = -RightLane.HalfWidth; break; case MarkupPoint.LocationType.RightEdge: LeftLane.NetLane.CalculatePositionAndDirection(Enter.T, out position, out direction); lineShift = LeftLane.HalfWidth; break; default: throw new Exception(); } direction = (Enter.IsStartSide ? -direction : direction).normalized; var shift = (lineShift + offset) / Mathf.Sin(Enter.CornerAndNormalAngle); position += Enter.CornerDir * shift; }
private void GetEdgePositionAndDirection(MarkupPoint.LocationType location, float offset, out Vector3 position, out Vector3 direction) { float lineShift; switch (location) { case MarkupPoint.LocationType.LeftEdge: RightLane.NetLane.CalculatePositionAndDirection(Enter.T, out position, out direction); lineShift = -RightLane.HalfWidth; break; case MarkupPoint.LocationType.RightEdge: LeftLane.NetLane.CalculatePositionAndDirection(Enter.T, out position, out direction); lineShift = LeftLane.HalfWidth; break; default: throw new Exception(); } direction = (direction * Enter.SideSign).normalized; var shift = (lineShift + offset) / Enter.TranformCoef; position += Enter.CornerDir * shift; }
public NetInfoPointSource(Enter enter, DriveLane leftLane, DriveLane rightLane, MarkupPoint.LocationType location) { Enter = enter; LeftLane = leftLane; RightLane = rightLane; Location = location; }
public NetInfoPointSource(Enter enter, DriveLane leftLane, DriveLane rightLane, MarkupPoint.LocationType location) { Enter = enter; LeftLane = leftLane; RightLane = rightLane; Location = location; NetworkType = (LeftLane == null ? NetworkType.None : leftLane.NetworkType) | (RightLane == null ? NetworkType.None : RightLane.NetworkType); }
public void GetPositionAndDirection(MarkupPoint.LocationType location, float offset, out Vector3 position, out Vector3 direction) { if ((location & MarkupPoint.LocationType.Between) != MarkupPoint.LocationType.None) { GetMiddlePosition(offset, out position, out direction); } else if ((location & MarkupPoint.LocationType.Edge) != MarkupPoint.LocationType.None) { GetEdgePosition(location, offset, out position, out direction); } else { throw new Exception(); } }