private void RenderTrafficLights(ushort nodeId, ref NetNode node, RenderManager.CameraInfo cameraInfo) { var pos = node.m_position; var alpha = MathUtils.SmoothStep(1000f, 500f, Vector3.Distance(cameraInfo.m_position, pos)); var scale = _hoveredNodeId == nodeId && _hoveredButtonIndex == -1 ? 1.0f : 0.75f; var lights = (node.m_flags & NetNode.Flags.TrafficLights) != NetNode.Flags.None ? NotificationEvent.Type.TrafficLightsOn : NotificationEvent.Type.TrafficLightsOff; NotificationEvent.RenderInstance(cameraInfo, lights, pos, scale, alpha); }
private void RenderStopSigns(ushort nodeId, ref NetNode node, RenderManager.CameraInfo cameraInfo) { //only display stop signs if no traffic lights if ((node.m_flags & NetNode.Flags.TrafficLights) != NetNode.Flags.None) { return; } var nm = Singleton <NetManager> .instance; var num = node.Info.m_halfWidth * 0.75f; var alpha = MathUtils.SmoothStep(1000f, 500f, Vector3.Distance(cameraInfo.m_position, node.m_position)); for (var index = 0; index < 8; ++index) { var segment = node.GetSegment(index); if (segment != 0) { var info = nm.m_segments.m_buffer[segment].Info; if ((info.m_vehicleTypes & VehicleInfo.VehicleType.Car) != VehicleInfo.VehicleType.None) { var flag3 = nm.m_segments.m_buffer[segment].m_startNode == nodeId; var flag4 = (nm.m_segments.m_buffer[segment].m_flags & NetSegment.Flags.Invert) != NetSegment.Flags.None; if ((flag3 != flag4 ? (info.m_hasBackwardVehicleLanes ? 1 : 0) : (info.m_hasForwardVehicleLanes ? 1 : 0)) != 0) { var scale = _hoveredNodeId == nodeId && _hoveredButtonIndex == index + 1 ? 1.0f : 0.75f; var vector3 = !flag3 ? nm.m_segments.m_buffer[segment].m_endDirection : nm.m_segments.m_buffer[segment].m_startDirection; var position = node.m_position + vector3 * num; var flags = !flag3 ? NetSegment.Flags.YieldEnd : NetSegment.Flags.YieldStart; var sign = (nm.m_segments.m_buffer[segment].m_flags & flags) != NetSegment.Flags.None ? NotificationEvent.Type.YieldOn : NotificationEvent.Type.YieldOff; NotificationEvent.RenderInstance(cameraInfo, sign, position, scale, alpha); } } } } }