Exemplo n.º 1
0
        public static bool IsCSURWideRoad(NetInfo asset)
        {
            if (asset == null || (asset.m_netAI.GetType() != typeof(RoadAI) && asset.m_netAI.GetType() != typeof(RoadBridgeAI) && asset.m_netAI.GetType() != typeof(RoadTunnelAI)))
            {
                return(false);
            }
            int laneNum = (int)CountCSURSVehicleLanes(asset) + (int)CountCSURSOtherLanes(asset, true);

            if (CSURUtil.IsCSURDual(asset))
            {
                if (laneNum >= 8)
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        public static float GetMinCornerOffset(float cornerOffset0, ushort nodeID)
        {
            var instance = Singleton <NetManager> .instance;

            if (OptionUI.fixLargeJunction)
            {
                // NON-STOCK CODE STARTS
                float m_minCornerOffset          = 0f;
                float tempMinCornerOffset        = 1000f;
                float finalCornerOffset          = 0f;
                int   segmentCount               = 0;
                bool  isCSURRoadFixLargeJunction = false;
                for (int i = 0; i < 8; i++)
                {
                    ushort segment1 = instance.m_nodes.m_buffer[nodeID].GetSegment(i);
                    if (segment1 != 0)
                    {
                        segmentCount++;
                        if (CSURUtil.IsCSUR(instance.m_segments.m_buffer[segment1].Info))
                        {
                            if (instance.m_segments.m_buffer[segment1].Info.m_nodes.Length == 0)
                            {
                                isCSURRoadFixLargeJunction = false;
                                break;
                            }
                            else
                            {
                                isCSURRoadFixLargeJunction = true;
                            }
                        }
                        if (instance.m_segments.m_buffer[segment1].Info.m_minCornerOffset < tempMinCornerOffset)
                        {
                            tempMinCornerOffset = instance.m_segments.m_buffer[segment1].Info.m_minCornerOffset;
                        }
                    }
                }

                if (isCSURRoadFixLargeJunction)
                {
                    if (tempMinCornerOffset != 1000f)
                    {
                        m_minCornerOffset = tempMinCornerOffset;
                    }

                    //direct node
                    if (segmentCount == 2)
                    {
                        finalCornerOffset = m_minCornerOffset / 2f;
                        if (finalCornerOffset > 24f)
                        {
                            finalCornerOffset = 24f;
                        }
                    }
                    else
                    {
                        finalCornerOffset = 0;
                    }
                    return(finalCornerOffset);
                }
            }
            return(cornerOffset0);
        }