Beispiel #1
0
        private static void SetupTextures(NetInfo info, NetInfoVersion version)
        {
            switch (version)
            {
            case NetInfoVersion.Ground:
            case NetInfoVersion.GroundGrass:
            case NetInfoVersion.GroundTrees:
                var suffix = version.ToString().Substring(6).Length > 0 ? "Grass" : "Concrete";
                info.SetAllSegmentsTexture(
                    new TextureSet
                        (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment__MainTex.png",
                        $@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment{suffix}__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment_LOD__MainTex.png",
                        $@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment{suffix}_LOD__APRMap.png",
                        @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment_LOD__XYSMap.png"));
                info.SetAllNodesTexture(
                    new TextureSet
                        (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_LOD__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_LOD__APRMap.png",
                        @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment_LOD__XYSMap.png"));


                foreach (var node in info.m_nodes)
                {
                    if (node.m_flagsForbidden == NetNode.Flags.Transition)
                    {
                        info.m_nodes[0].SetTextures(
                            new TextureSet
                                (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_Simple__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_Simple__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_LOD__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_LOD__APRMap.png",
                                @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment_LOD__XYSMap.png"));
                    }
                    else if (node.m_flagsRequired == NetNode.Flags.Transition)
                    {
                        node.SetTextures(
                            new TextureSet
                                (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_LOD__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_LOD__APRMap.png",
                                @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment_LOD__XYSMap.png"));
                    }
                }
                break;
            }
        }
        public void BuildUp(NetInfo info, NetInfoVersion version)
        {
            ///////////////////////////
            // Template              //
            ///////////////////////////
            var roadTunnelInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ROAD_4L_TUNNEL);
            var roadInfo       = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ROAD_6L);

            ///////////////////////////
            // 3DModeling            //
            ///////////////////////////
            info.Setup32m3mSW2x3mMdnBusMesh(version);

            ///////////////////////////
            // Texturing             //
            ///////////////////////////
            SetupTextures(info, version);

            ///////////////////////////
            // Set up                //
            ///////////////////////////
            info.m_hasParkingSpaces = true;
            info.m_pavementWidth    = (version == NetInfoVersion.Slope || version == NetInfoVersion.Tunnel ? 4 : 3);
            info.m_halfWidth        = (version == NetInfoVersion.Tunnel ? 17 : 16);

            if (version == NetInfoVersion.Tunnel)
            {
                info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground;
                info.m_setCitizenFlags = CitizenInstance.Flags.Transition | CitizenInstance.Flags.Underground;
                info.m_class           = roadTunnelInfo.m_class.Clone(NetInfoClasses.NEXT_XLARGE_ROAD_TUNNEL);
            }
            else
            {
                info.m_class = info.m_class.Clone("NEXTFourDevidedLaneBusAvenue4Parking" + version.ToString());
            }
            info.m_canCrossLanes = false;
            // Setting up lanes
            info.SetRoadLanes(version, new LanesConfiguration
            {
                IsTwoWay        = true,
                LanesToAdd      = 2,
                LaneWidth       = version == NetInfoVersion.Slope ? 2.75f : 3,
                PedPropOffsetX  = version == NetInfoVersion.Slope ? 1.5f : 1f,
                CenterLane      = CenterLaneType.Median,
                CenterLaneWidth = 2,
                BusStopOffset   = 0,
                HasBusStop      = false
            });

            var carLanes  = info.m_lanes.Where(l => l.m_laneType == NetInfo.LaneType.Vehicle).ToList();
            var pedkLanes = info.m_lanes.Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian).ToList();
            var parking   = info.m_lanes.Where(l => l.m_laneType == NetInfo.LaneType.Parking).ToList();



            carLanes[0].m_direction      = NetInfo.Direction.Backward;
            carLanes[0].m_finalDirection = NetInfo.Direction.Backward;
            carLanes[0].m_position       = -9.5f;

            carLanes[1].m_position       = -6.6f;
            carLanes[1].m_direction      = NetInfo.Direction.Backward;
            carLanes[1].m_finalDirection = NetInfo.Direction.Backward;
            carLanes[1].m_stopType       = VehicleInfo.VehicleType.None;

            carLanes[2].m_position       = -1.5f;
            carLanes[2].m_direction      = NetInfo.Direction.Backward;
            carLanes[2].m_finalDirection = NetInfo.Direction.Backward;
            carLanes[2].m_laneType       = NetInfo.LaneType.TransportVehicle;
            carLanes[2].m_stopType       = VehicleInfo.VehicleType.Car;
            var tempProps = carLanes[2].m_laneProps.m_props.ToList();

            tempProps.RemoveProps("arrow");
            carLanes[2].m_laneProps.m_props = tempProps.ToArray();
            carLanes[2].m_stopType          = VehicleInfo.VehicleType.None;


            carLanes[3].m_position       = 1.5f;
            carLanes[3].m_direction      = NetInfo.Direction.Forward;
            carLanes[3].m_finalDirection = NetInfo.Direction.Forward;
            carLanes[3].m_laneType       = NetInfo.LaneType.TransportVehicle;
            carLanes[3].m_stopType       = VehicleInfo.VehicleType.Car;
            tempProps = carLanes[3].m_laneProps.m_props.ToList();
            tempProps.RemoveProps("arrow");
            carLanes[3].m_laneProps.m_props = tempProps.ToArray();

            BusRoads.BusRoadsHelper.SetBusLaneProps(carLanes[2]);
            BusRoads.BusRoadsHelper.SetBusLaneProps(carLanes[3]);


            carLanes[4].m_position = 6.6f;
            //  carLanes[4].m_speedLimit = .2f;
            carLanes[4].m_direction      = NetInfo.Direction.Forward;
            carLanes[4].m_finalDirection = NetInfo.Direction.Forward;
            carLanes[4].m_stopType       = VehicleInfo.VehicleType.None;


            carLanes[5].m_position       = 9.5f;
            carLanes[5].m_direction      = NetInfo.Direction.Forward;
            carLanes[5].m_finalDirection = NetInfo.Direction.Forward;
            carLanes[5].m_stopType       = VehicleInfo.VehicleType.None;



            var leftPedLane  = info.GetLeftRoadShoulder();
            var rightPedLane = info.GetRightRoadShoulder();

            var leftPed = info.GetLeftRoadShoulder().CloneWithoutStops();

            leftPed.m_width    = 1f;
            leftPed.m_position = -3.8f;



            tempProps = leftPed.m_laneProps.m_props.ToList();
            tempProps.RemoveProps("light");
            tempProps.RemoveProps("limit");
            tempProps.RemoveProps("random");
            leftPed.m_laneProps.m_props = tempProps.ToArray();



            var rightPed = info.GetRightRoadShoulder().CloneWithoutStops();

            rightPed.m_position = 3.8f;
            rightPed.m_width    = 1f;



            tempProps = rightPed.m_laneProps.m_props.ToList();
            tempProps.RemoveProps("light");
            tempProps.RemoveProps("limit");
            tempProps.RemoveProps("random");
            rightPed.m_laneProps.m_props = tempProps.ToArray();



            rightPed.m_stopType     = VehicleInfo.VehicleType.Car;
            leftPed.m_stopType      = VehicleInfo.VehicleType.Car;
            leftPedLane.m_stopType  = VehicleInfo.VehicleType.None;
            rightPedLane.m_stopType = VehicleInfo.VehicleType.None;



            var centerLane1 = info.GetMedianLane().CloneWithoutStops();
            var centerLane2 = info.GetMedianLane().CloneWithoutStops();

            centerLane1.m_width    = 1f;
            centerLane2.m_width    = 1f;
            centerLane1.m_position = -4.3f;
            centerLane2.m_position = 4.3f;

            var leftPedLaneProps  = leftPed.m_laneProps.m_props.ToList();
            var rightPedLaneProps = rightPed.m_laneProps.m_props.ToList();


            var centerLane1PedLaneProps = centerLane1.m_laneProps.m_props.ToList();
            var centerLane2PedLaneProps = centerLane2.m_laneProps.m_props.ToList();

            if (version == NetInfoVersion.GroundTrees)
            {
                var treeProp = new NetLaneProps.Prop()
                {
                    m_tree           = Prefabs.Find <TreeInfo>("Tree2variant"),
                    m_repeatDistance = 30,
                    m_probability    = 100,
                };
                treeProp.m_position.x = 0;
                centerLane1PedLaneProps.Add(treeProp.ShallowClone());
                centerLane2PedLaneProps.Add(treeProp.ShallowClone());
            }


            var centerLane1StreetLight = centerLane1PedLaneProps?.FirstOrDefault(p => {
                if (p == null || p.m_prop == null)
                {
                    return(false);
                }
                return(p.m_prop.name.ToLower().Contains("avenue light"));
            });


            var centerLane1TrafficLight = centerLane1PedLaneProps?.FirstOrDefault(p => {
                if (p == null || p.m_prop == null)
                {
                    return(false);
                }
                return(p.m_prop.name.ToLower().Contains("traffic light"));
            });

            if (centerLane1StreetLight != null)
            {
                centerLane1StreetLight.m_finalProp =
                    centerLane1StreetLight.m_prop  = Prefabs.Find <PropInfo>(MediumAvenueSideLightBuilder.NAME);
                centerLane1StreetLight.m_angle     = 180;
                var lefttLigth = centerLane1StreetLight.ShallowClone();
                lefttLigth.m_position = new Vector3(-9.8f, 0, 0);
                leftPedLaneProps.AddProp(lefttLigth);
            }
            var centerLane2StreetLight = centerLane2PedLaneProps?.FirstOrDefault(p =>
            {
                if (p == null || p.m_prop == null)
                {
                    return(false);
                }
                return(p.m_prop.name.ToLower().Contains("avenue light"));
            });

            if (centerLane2StreetLight != null)
            {
                centerLane2StreetLight.m_finalProp =
                    centerLane2StreetLight.m_prop  = Prefabs.Find <PropInfo>(MediumAvenueSideLightBuilder.NAME);
                centerLane2StreetLight.m_angle     = 0;
                var rightLigth = centerLane2StreetLight.ShallowClone();
                rightLigth.m_position = new Vector3(9.8f, 0, 0);
                rightPedLaneProps.AddProp(rightLigth);
            }



            var ind    = 0;
            var indped = 0;

            centerLane1PedLaneProps?.ForEach(p => {
                if (p == null || p.m_prop == null)
                {
                    return;
                }

                if (p.m_prop.name.ToLower().Contains("pedestrian"))
                {
                    indped++;
                    p.m_position = new Vector3(-0.9f, 0, 0);
                    p.m_angle    = 270;
                    return;
                }

                if (p.m_prop.name.ToLower().Contains("mirror"))
                {
                    ind++;

                    if (ind == 1)
                    {
                        p.m_finalProp =
                            p.m_prop  = Prefabs.Find <PropInfo>("Traffic Light Pedestrian");
                    }
                    else
                    {
                        p.m_finalProp =
                            p.m_prop  = Prefabs.Find <PropInfo>("Traffic Light 02");
                        p.m_position  = new Vector3(.9f, 0, 0);
                    }
                }
            });

            ind    = 0;
            indped = 0;
            centerLane2PedLaneProps?.ForEach(p => {
                if (p == null || p.m_prop == null)
                {
                    return;
                }

                if (p.m_prop.name.ToLower().Contains("pedestrian"))
                {
                    indped++;
                    p.m_position = new Vector3(0.9f, 0, 0);
                    p.m_angle    = 90;
                    return;
                }

                if (p.m_prop.name.ToLower().Contains("mirror"))
                {
                    ind++;

                    if (ind == 2)
                    {
                        p.m_finalProp =
                            p.m_prop  = Prefabs.Find <PropInfo>("Traffic Light Pedestrian");
                    }
                    else
                    {
                        p.m_finalProp =
                            p.m_prop  = Prefabs.Find <PropInfo>("Traffic Light 02");
                        p.m_position  = new Vector3(-.9f, 0, 0);
                    }
                }
            });

            if (centerLane1PedLaneProps != null)
            {
                //     centerLane1PedLaneProps.RemoveProps("light");
                centerLane1PedLaneProps.RemoveProps("bus");
                centerLane1PedLaneProps.RemoveProps("avenue side");
                centerLane1PedLaneProps.RemoveProps("50 Speed Limit");
            }
            if (centerLane2PedLaneProps != null)
            {
                // centerLane2PedLaneProps.RemoveProps("light");
                centerLane2PedLaneProps.RemoveProps("bus");
                centerLane2PedLaneProps.RemoveProps("avenue side");
                centerLane2PedLaneProps.RemoveProps("50 Speed Limit");
            }
            if (centerLane1?.m_laneProps != null && centerLane1PedLaneProps != null)
            {
                centerLane1.m_laneProps.m_props = centerLane1PedLaneProps.ToArray();
            }

            if (centerLane2?.m_laneProps != null && centerLane2PedLaneProps != null)
            {
                centerLane2.m_laneProps.m_props = centerLane2PedLaneProps.ToArray();
            }
            //var centerLaneProps = new List<NetLaneProps.Prop>();

            centerLane1.m_laneProps.m_props = centerLane1PedLaneProps.ToArray();
            centerLane2.m_laneProps.m_props = centerLane2PedLaneProps.ToArray();

            leftPed.m_laneProps.m_props  = leftPedLaneProps.ToArray();
            rightPed.m_laneProps.m_props = rightPedLaneProps.ToArray();


            var pedLanes = new List <NetInfo.Lane>();

            pedLanes.Add(rightPed);
            pedLanes.Add(leftPed);
            pedLanes.Add(leftPedLane);
            pedLanes.Add(rightPedLane);
            //carLanes[4].m_position += 1;
            var tempLanes = new List <NetInfo.Lane>();

            tempLanes.Add(centerLane1);
            tempLanes.Add(centerLane2);
            tempLanes.AddRange(pedLanes);
            //  tempLanes.AddRange(pedkLanes);
            tempLanes.AddRange(carLanes);
            tempLanes.AddRange(parking);
            info.m_lanes = tempLanes.ToArray();



            // AI
            var owPlayerNetAI = roadInfo.GetComponent <PlayerNetAI>();
            var playerNetAI   = info.GetComponent <PlayerNetAI>();

            if (owPlayerNetAI != null && playerNetAI != null)
            {
                playerNetAI.m_constructionCost = owPlayerNetAI.m_constructionCost * 3; // Charge by the lane?
                playerNetAI.m_maintenanceCost  = owPlayerNetAI.m_maintenanceCost * 3;  // Charge by the lane?
            }

            var roadBaseAI = info.GetComponent <RoadBaseAI>();

            if (roadBaseAI != null)
            {
                roadBaseAI.m_trafficLights = true;
            }
        }
        public static void CreateBaseLevelCrossing(NetInfo info, NetInfoVersion version)
        {
            var isStation = info.name.Contains("Station");

            if (version != NetInfoVersion.Tunnel)
            {
                var pavementIndex = -1;
                var railIndex     = -1;
                for (var i = 0; i < info.m_nodes.Length; i++)
                {
                    if (info.m_nodes[i].m_flagsRequired == NetNode.Flags.LevelCrossing)
                    {
                        if (info.m_nodes[i].m_directConnect == false)
                        {
                            pavementIndex = i;
                            break;
                        }
                    }
                }
                for (var i = 0; i < info.m_nodes.Length; i++)
                {
                    if (info.m_nodes[i].m_directConnect == true)
                    {
                        railIndex = i;
                        break;
                    }
                }
                var nodes0 = info.m_nodes[pavementIndex].ShallowClone();
                var nodes1 = info.m_nodes[railIndex].ShallowClone();
                var nodes2 = info.m_nodes[pavementIndex].ShallowClone();

                NodeList.Add(nodes0);

                var isSteel = info.name.Contains("Steel");
                var prefix  = "";
                if (version == NetInfoVersion.Elevated || version == NetInfoVersion.Bridge)
                {
                    prefix = "Elevated";
                }
                else
                {
                    prefix = version.ToString();
                }
                nodes0
                .SetMeshes
                    ($@"Meshes\{WidthName}\{prefix}_LevelCrossing_Pavement.obj",
                    $@"Meshes\{WidthName}\LevelCrossing_Pavement_LOD.obj")
                .SetConsistentUVs();
                if (!isStation || LikenessGroups.Count > 0)
                {
                    NodeList.Add(nodes1);
                    NodeList.Add(nodes2);
                    if (WidthName != "10m")
                    {
                        nodes1
                        .SetFlags(NetNode.Flags.LevelCrossing, NetNode.Flags.None)
                        .SetMeshes
                            ($@"Meshes\{WidthName}\LevelCrossing_{(isStation && WidthName != "6m" ? "Station_" : "")}Rail.obj",
                            $@"Meshes\{WidthName}\LevelCrossing_Rail_LOD.obj")
                        .SetConsistentUVs();
                    }
                    else
                    {
                        nodes1
                        .SetFlags(NetNode.Flags.LevelCrossing, NetNode.Flags.None)
                        .SetMeshes
                            ($@"Meshes\{WidthName}\LevelCrossing_{(isStation && WidthName != "6m" ? "Station_" : "")}Rail.obj")
                        .SetConsistentUVs();
                    }

                    nodes2
                    .SetMeshes
                        ($@"Meshes\{WidthName}\LevelCrossing_{(isStation && WidthName != "6m" ? "Station_" : "")}Rail_Insert.obj", @"Meshes\10m\Blank.obj")
                    .SetConsistentUVs();

                    nodes1.m_directConnect = true;
                    nodes2.m_directConnect = true;

                    for (var i = 0; i < LikenessGroups.Count; i++)
                    {
                        if (i == 0)
                        {
                            nodes1.m_connectGroup = LikenessGroups[i];
                            nodes2.m_connectGroup = LikenessGroups[i];
                        }
                        else
                        {
                            nodes1.m_connectGroup |= LikenessGroups[i];
                            nodes2.m_connectGroup |= LikenessGroups[i];
                        }
                    }
                }

                if (!isSteel && (version == NetInfoVersion.Elevated || version == NetInfoVersion.Bridge))
                {
                    var nodes3 = info.m_nodes[pavementIndex].ShallowClone();
                    NodeList.Add(nodes3);
                    nodes3
                    .SetMeshes
                        ($@"Meshes\{WidthName}\{prefix}_Node_Pavement_Short.obj",
                        $@"Meshes\{WidthName}\LevelCrossing_Pavement_LOD.obj")
                    .SetConsistentUVs();
                }
            }
        }
        public void BuildUp(NetInfo info, NetInfoVersion version)
        {
            ///////////////////////////
            // Template              //
            ///////////////////////////
            if (version == NetInfoVersion.GroundGrass || version == NetInfoVersion.GroundTrees)
            {
                var roadInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ROAD_2L);
                info.m_segments = roadInfo.m_segments.Select(x => x.ShallowClone()).ToArray();
                info.m_nodes    = roadInfo.m_nodes.Select(x => x.ShallowClone()).ToArray();
                info.m_lanes    = roadInfo.m_lanes.Select(x => x.ShallowClone()).ToArray();
            }

            ///////////////////////////
            // 3DModeling            //
            ///////////////////////////
            info.Setup16m3mSW3mMdnMesh(version);

            ///////////////////////////
            // Texturing             //
            ///////////////////////////
            SetupTextures(info, version);

            ///////////////////////////
            // Set up                //
            ///////////////////////////
            info.m_hasParkingSpaces = false;

            info.m_pavementWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 3 : 6);
            info.m_halfWidth     = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 8 : 11);
            info.m_canCrossLanes = false;
            if (version == NetInfoVersion.Tunnel)
            {
                info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground;
                info.m_setCitizenFlags = CitizenInstance.Flags.Transition | CitizenInstance.Flags.Underground;
                info.m_class           = info.m_class.Clone("NEXTbasicroadmedian" + version.ToString());
            }
            else
            {
                info.m_class = info.m_class.Clone("NEXTbasicroadmedian" + version.ToString());
            }

            // Setting up lanes
            info.SetRoadLanes(version, new LanesConfiguration
            {
                IsTwoWay        = true,
                LaneWidth       = 3.3f,
                SpeedLimit      = 0.8f,
                CenterLane      = CenterLaneType.Median,
                CenterLaneWidth = 3.3f
            });
            var leftPedLane  = info.GetLeftRoadShoulder();
            var rightPedLane = info.GetRightRoadShoulder();

            //Setting Up Props
            var leftRoadProps  = leftPedLane.m_laneProps.m_props.ToList();
            var rightRoadProps = rightPedLane.m_laneProps.m_props.ToList();
            var centerLane     = new NetInfo.Lane();

            centerLane.m_position       = 0;
            centerLane.m_laneProps      = ScriptableObject.CreateInstance <NetLaneProps>();
            centerLane.m_laneProps.name = "Center Lane Props";
            centerLane.m_vehicleType    = VehicleInfo.VehicleType.None;
            var centerLaneProps = new List <NetLaneProps.Prop>();

            if (version == NetInfoVersion.GroundTrees)
            {
                var treeProp = new NetLaneProps.Prop()
                {
                    m_tree           = Prefabs.Find <TreeInfo>("Tree2variant"),
                    m_repeatDistance = 20,
                    m_probability    = 100,
                };
                treeProp.m_position.x = 0;
                centerLaneProps.Add(treeProp);
            }
            else if (version == NetInfoVersion.Slope)
            {
                leftRoadProps.AddLeftWallLights(info.m_pavementWidth);
                rightRoadProps.AddRightWallLights(info.m_pavementWidth);
            }
            centerLane.m_laneProps.m_props   = centerLaneProps.ToArray();
            leftPedLane.m_laneProps.m_props  = leftRoadProps.ToArray();
            rightPedLane.m_laneProps.m_props = rightRoadProps.ToArray();
            var lanes = info.m_lanes.ToList();

            lanes.Add(centerLane);
            info.m_lanes = lanes.ToArray();
            //info.TrimAboveGroundProps(version);
            //info.SetupNewSpeedLimitProps(50, 40);


            // AI
            //var owPlayerNetAI = roadInfo.GetComponent<PlayerNetAI>();
            //var playerNetAI = info.GetComponent<PlayerNetAI>();

            //if (owPlayerNetAI != null && playerNetAI != null)
            //{
            //    playerNetAI.m_constructionCost = owPlayerNetAI.m_constructionCost ; // Charge by the lane?
            //    playerNetAI.m_maintenanceCost = owPlayerNetAI.m_maintenanceCost; // Charge by the lane?
            //}

            var roadBaseAI = info.GetComponent <RoadBaseAI>();

            if (roadBaseAI != null)
            {
                roadBaseAI.m_trafficLights = false;
            }
        }
        private static int GetTrackMaintCost(NetInfoVersion version)
        {
            var metroInfo = PrefabCollection <NetInfo> .FindLoaded("Metro Track");

            var trainInfo = PrefabCollection <NetInfo> .FindLoaded("Train Track");

            double coeff = (double)((PlayerNetAI)metroInfo.m_netAI).m_maintenanceCost / ((PlayerNetAI)trainInfo.m_netAI).m_maintenanceCost;
            var    info  = PrefabCollection <NetInfo> .FindLoaded($"Train Track{(version != NetInfoVersion.Ground ? " " + version.ToString() : "")}");

            return((int)Math.Round(((PlayerNetAI)info.m_netAI).m_maintenanceCost * coeff));
        }
        private static void SetupTextures(NetInfo info, NetInfoVersion version)
        {
            switch (version)
            {
            case NetInfoVersion.Ground:
            case NetInfoVersion.GroundGrass:
            case NetInfoVersion.GroundTrees:
                var suffix = version.ToString().Substring(6).Length > 0 ? "Grass" : "Concrete";
                for (int i = 0; i < info.m_segments.Length; i++)
                {
                    if (info.m_segments[i].m_mesh.name.ToLower().Contains("median"))
                    {
                        info.m_segments[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median__MainTex.png",
                                $@"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median{suffix}__AlphaMap.png"),
                            new LODTextureSet
                                (@"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median_LOD__MainTex.png",
                                $@"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median{suffix}_LOD__AlphaMap.png",
                                @"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median_LOD__XYSMap.png"));
                    }
                    else
                    {
                        info.m_segments[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Ground_Segment__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Ground_Segment__AlphaMap.png"),
                            new LODTextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Ground_SegmentLOD__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Ground_SegmentLOD__AlphaMap.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Ground_SegmentLOD__XYS.png"));
                    }
                }
                for (int i = 0; i < info.m_nodes.Length; i++)
                {
                    if (info.m_nodes[i].m_mesh.name.ToLower().Contains("median"))
                    {
                        info.m_nodes[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median__MainTex.png",
                                @"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_MedianConcrete__AlphaMap.png"));
                    }
                }
                break;

            case NetInfoVersion.Elevated:
            case NetInfoVersion.Bridge:
                for (int i = 0; i < info.m_segments.Length; i++)
                {
                    if (info.m_segments[i].m_mesh.name.ToLower().Contains("median"))
                    {
                        info.m_segments[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median__MainTex.png",
                                @"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_MedianConcrete__AlphaMap.png"),
                            new LODTextureSet
                                (@"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median_LOD__MainTex.png",
                                @"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_MedianConcrete_LOD__AlphaMap.png",
                                @"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median_LOD__XYSMap.png"));
                    }
                    else
                    {
                        info.m_segments[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Elevated_MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Elevated_Segment__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Elevated_LOD__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Elevated_SegmentLOD__APRMap.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Elevated_LOD__XYSMap.png"));
                    }
                }
                for (int i = 0; i < info.m_nodes.Length; i++)
                {
                    if (info.m_nodes[i].m_mesh.name.ToLower().Contains("median"))
                    {
                        info.m_nodes[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median__MainTex.png",
                                @"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_MedianConcrete__AlphaMap.png"));
                    }
                    else
                    {
                        info.m_nodes[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Elevated_MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Elevated_Node__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Elevated_LOD__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Elevated_NodeLOD__APRMap.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Elevated_LOD__XYSMap.png"));
                    }
                }
                break;

            case NetInfoVersion.Slope:
                for (int i = 0; i < info.m_segments.Length; i++)
                {
                    if (info.m_segments[i].m_mesh.name == "Slope")
                    {
                        info.m_segments[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Ground_Segment__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Ground_Segment__AlphaMap.png"),
                            new LODTextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Ground_SegmentLOD__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Ground_SegmentLOD__AlphaMap.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Slope_SegmentLOD2__XYSMap.png"));
                    }
                    else if (info.m_segments[i].m_mesh.name.ToLower().Contains("median"))
                    {
                        info.m_segments[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median__MainTex.png",
                                @"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_MedianConcrete__AlphaMap.png"),
                            new LODTextureSet
                                (@"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median_LOD__MainTex.png",
                                @"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_MedianConcrete_LOD__AlphaMap.png",
                                @"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median_LOD__XYSMap.png"));
                    }
                    else
                    {
                        info.m_segments[i].SetTextures(
                            new TextureSet
                                (@"Roads\Highways\Highway4L\Textures\Slope_Segment__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Slope_Segment__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Slope_SegmentLOD__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Slope_SegmentLOD__APRMap.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Slope_SegmentLOD__XYSMap.png"));
                    }
                }
                for (int i = 0; i < info.m_nodes.Length; i++)
                {
                    if (info.m_nodes[i].m_mesh.name == "Slope_Node")
                    {
                        info.m_nodes[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Ground_Segment__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Ground_Node__AlphaMap.png"),
                            new LODTextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Ground_SegmentLOD__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Ground_SegmentLOD__AlphaMap.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Ground_SegmentLOD__XYS.png"));
                    }
                    else if (info.m_nodes[i].m_mesh.name.ToLower().Contains("median"))
                    {
                        info.m_nodes[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median__MainTex.png",
                                @"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_MedianConcrete__AlphaMap.png"));
                    }
                    else
                    {
                        info.m_nodes[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_Segment__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_Node__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_NodeLOD__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_LOD__APRMap.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_LOD__XYSMap.png"));
                    }
                }
                //info.SetAllNodesTexture(
                //new TextureSet
                //    (@"Roads\Highways\Highway4L\Textures\Slope_Node__MainTex.png",
                //    @"Roads\Highways\Highway4L\Textures\Ground_Node__APRMap.png"),
                //new LODTextureSet
                //    (@"Roads\Highways\Highway4L\Textures\Ground_NodeLOD__MainTex.png",
                //    @"Roads\Highways\Highway4L\Textures\Ground_NodeLOD__APRMap.png",
                //    @"Roads\Highways\Highway4L\Textures\Ground_LOD__XYSMap.png"));
                break;

            case NetInfoVersion.Tunnel:
            {
                for (int i = 0; i < info.m_segments.Length; i++)
                {
                    if (info.m_segments[i].m_mesh.name.ToLower().Contains("median"))
                    {
                        info.m_segments[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median__MainTex.png",
                                @"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_MedianConcrete__AlphaMap.png"),
                            new LODTextureSet
                                (@"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median_LOD__MainTex.png",
                                @"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_MedianConcrete_LOD__AlphaMap.png",
                                @"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median_LOD__XYSMap.png"));
                    }
                    else
                    {
                        info.m_segments[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_Segment__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_Segment__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_NodeLOD__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_LOD__APRMap.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_LOD__XYSMap.png"));
                    }
                }
                for (int i = 0; i < info.m_nodes.Length; i++)
                {
                    if (info.m_nodes[i].m_mesh.name.ToLower().Contains("median"))
                    {
                        info.m_nodes[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_Median__MainTex.png",
                                @"Roads\SmallRoads\BasicRoadMdn\Textures\Ground_Segment_MedianConcrete__AlphaMap.png"));
                    }
                    else
                    {
                        info.m_nodes[i].SetTextures(
                            new TextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_Segment__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_Node__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_NodeLOD__MainTex.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_LOD__APRMap.png",
                                @"Roads\SmallHeavyRoads\BasicRoadTL\Textures\Tunnel_LOD__XYSMap.png"));
                    }
                }
                break;
            }
            }
        }
Beispiel #7
0
 public static string NameBuilder(string baseName, NetInfoVersion version)
 {
     return($"{baseName}{(version == NetInfoVersion.Ground ? "" : " " + version.ToString())}".Trim());
 }
        public void BuildUp(NetInfo info, NetInfoVersion version)
        {
            ///////////////////////////
            // Template              //
            ///////////////////////////
            if (version == NetInfoVersion.GroundGrass || version == NetInfoVersion.GroundTrees)
            {
                var roadInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ROAD_2L);
                info.m_segments = roadInfo.m_segments.Select(x => x.ShallowClone()).ToArray();
                info.m_nodes    = roadInfo.m_nodes.Select(x => x.ShallowClone()).ToArray();
                info.m_lanes    = roadInfo.m_lanes.Select(x => x.ShallowClone()).ToArray();
            }

            ///////////////////////////
            // 3DModeling            //
            ///////////////////////////
            info.Setup16m3mSW3mBikelaneMesh(version, LanesLayoutStyle.AsymL1R3);

            ///////////////////////////
            // Texturing             //
            ///////////////////////////
            SetupTextures(info, version);

            ///////////////////////////
            // Set up                //
            ///////////////////////////
            info.m_hasParkingSpaces = true;

            info.m_pavementWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 2 : 5);
            info.m_halfWidth     = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 8 : 11);
            info.m_canCrossLanes = false;
            if (version == NetInfoVersion.Tunnel)
            {
                info.m_setVehicleFlags  = Vehicle.Flags.Transition | Vehicle.Flags.Underground;
                info.m_setCitizenFlags  = CitizenInstance.Flags.Transition | CitizenInstance.Flags.Underground;
                info.m_class            = info.m_class.Clone("NEXTbasicroadmedian" + version.ToString());
                info.m_hasParkingSpaces = false;
            }
            else
            {
                info.m_class = info.m_class.Clone("NEXTbasicroadmedian" + version.ToString());
            }

            // Setting up lanes
            info.SetRoadLanes(version, new LanesConfiguration
            {
                IsTwoWay       = false,
                LanesToAdd     = 1,
                PedPropOffsetX = 0.5f,
                BusStopOffset  = 0f,
                LaneWidth      = 3.3f,
                SpeedLimit     = 0.8f,
            });
            var leftPedLane   = info.GetLeftRoadShoulder();
            var rightPedLane  = info.GetRightRoadShoulder();
            var laneWidth     = 3;
            var bikeLaneWidth = .8f;
            var vehicleLanes  = info.m_lanes.Where(l => l.m_laneType == NetInfo.LaneType.Vehicle).ToList();
            var carLanes      = new List <NetInfo.Lane>();
            var bikeLanes     = new List <NetInfo.Lane>();
            var parkWidth     = 2;
            var parkLanes     = info.m_lanes.Where(l => l.m_laneType == NetInfo.LaneType.Parking).ToList();

            bikeLanes.AddRange(vehicleLanes.Take(1));
            carLanes.AddRange(vehicleLanes.Skip(1));
            carLanes[0].m_width          = laneWidth;
            carLanes[0].m_position       = 0;
            carLanes[0].m_direction      = NetInfo.Direction.Forward;
            carLanes[0].m_verticalOffset = -0.2f;
            bikeLanes.AddRange(vehicleLanes.Skip(2));

            for (var i = 0; i < bikeLanes.Count; i++)
            {
                bikeLanes[i].m_vehicleType    = VehicleInfo.VehicleType.Bicycle;
                bikeLanes[i].m_position       = i == 1 ? 5.2f : -5.2f;
                bikeLanes[i].m_width          = bikeLaneWidth;
                bikeLanes[i].m_verticalOffset = 0f;
                bikeLanes[i].m_direction      = i == 1 ? NetInfo.Direction.Forward : NetInfo.Direction.Backward;
                bikeLanes[i].m_speedLimit     = 0.6f;
                bikeLanes[i].m_verticalOffset = -0.2f;
                bikeLanes[i].m_stopType       = VehicleInfo.VehicleType.None;

                bikeLanes[i].SetBikeLaneProps();
            }


            for (var i = 0; i < parkLanes.Count; i++)
            {
                parkLanes[i].m_width          = parkWidth;
                parkLanes[i].m_verticalOffset = -0.2f;
                parkLanes[i].m_position       = i == 1? -2.9f:2.9f;
                parkLanes[i].m_direction      = NetInfo.Direction.Forward;
                parkLanes[i].m_stopType       = VehicleInfo.VehicleType.Car;
            }
            var pedLanes = info.m_lanes.Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian).ToList();

            for (int i = 0; i < pedLanes.Count(); i++)
            {
                pedLanes[i].m_verticalOffset = 0.15f;
                pedLanes[i].m_stopType       = VehicleInfo.VehicleType.None;
            }

            //Setting Up Props
            var leftRoadProps  = leftPedLane.m_laneProps.m_props.ToList();
            var rightRoadProps = rightPedLane.m_laneProps.m_props.ToList();

            var tempLanes = new List <NetInfo.Lane>();

            tempLanes.AddRange(bikeLanes);
            tempLanes.AddRange(carLanes);
            tempLanes.AddRange(parkLanes);
            tempLanes.AddRange(pedLanes);
            info.m_lanes = tempLanes.ToArray();

            //Setting Up Props

            if (version == NetInfoVersion.Slope)
            {
                leftRoadProps.AddLeftWallLights(info.m_pavementWidth);
                rightRoadProps.AddRightWallLights(info.m_pavementWidth);
            }

            leftPedLane.m_laneProps.m_props  = leftRoadProps.ToArray();
            rightPedLane.m_laneProps.m_props = rightRoadProps.ToArray();

            info.TrimAboveGroundProps(version);
            info.SetupNewSpeedLimitProps(50, 40);

            /*
             * // AI
             * var owPlayerNetAI = owRoadInfo.GetComponent<PlayerNetAI>();
             * var playerNetAI = info.GetComponent<PlayerNetAI>();
             *
             * if (owPlayerNetAI != null && playerNetAI != null)
             * {
             *  playerNetAI.m_constructionCost = owPlayerNetAI.m_constructionCost * 2; // Charge by the lane?
             *  playerNetAI.m_maintenanceCost = owPlayerNetAI.m_maintenanceCost * 2; // Charge by the lane?
             * }
             */
            // TODO: make it configurable
            var roadBaseAI = info.GetComponent <RoadBaseAI>();

            if (roadBaseAI != null)
            {
                roadBaseAI.m_trafficLights = false;
            }
        }
Beispiel #9
0
        public void BuildUp(NetInfo info, NetInfoVersion version)
        {
            ///////////////////////////
            // Template              //
            ///////////////////////////
            var highwayInfo       = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L);
            var highwayTunnelInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L_TUNNEL);


            ///////////////////////////
            // 3DModeling            //
            ///////////////////////////
            info.Setup24mMesh(version);

            ///////////////////////////
            // Texturing             //
            ///////////////////////////
            SetupTextures(info, version);


            ///////////////////////////
            // Set up                //
            ///////////////////////////
            info.m_availableIn = ItemClass.Availability.All;
            //info.m_class = highwayInfo.m_class.Clone(NetInfoClasses.NEXT_HIGHWAY2L2W);
            info.m_surfaceLevel            = 0;
            info.m_createPavement          = !(version == NetInfoVersion.Ground || version == NetInfoVersion.Tunnel);
            info.m_createGravel            = version == NetInfoVersion.Ground;
            info.m_averageVehicleLaneSpeed = 1.8f;
            info.m_hasParkingSpaces        = false;
            info.m_hasPedestrianLanes      = false;
            info.m_UnlockMilestone         = highwayInfo.m_UnlockMilestone;
            info.m_halfWidth        = (version == NetInfoVersion.Bridge || version == NetInfoVersion.Elevated) ? 11 : 12;
            info.m_pavementWidth    = 2f;
            info.m_maxBuildAngle    = 90;
            info.m_maxBuildAngleCos = 0;
            if (version == NetInfoVersion.Tunnel)
            {
                info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground;
                info.m_class           = highwayTunnelInfo.m_class.Clone(info.name + version.ToString() + "Class");
            }
            else
            {
                info.m_class = highwayInfo.m_class.Clone(info.name + version.ToString() + "Class");
            }

            ///////////////////////////
            // Set up lanes          //
            ///////////////////////////
            info.SetRoadLanes(version, new LanesConfiguration
            {
                LanePositionOffst = (version == NetInfoVersion.Bridge || version == NetInfoVersion.Elevated) ? -1 : -2,
                IsTwoWay          = true,
                LaneWidth         = 4,
                LanesToAdd        = 1,
                SpeedLimit        = 1.8f
            });

            ///////////////////////////
            // Set up props          //
            ///////////////////////////
            var leftPedLane  = info.GetLeftRoadShoulder();
            var rightPedLane = info.GetRightRoadShoulder();

            var leftRoadProps  = leftPedLane?.m_laneProps.m_props.ToList();
            var rightRoadProps = rightPedLane?.m_laneProps.m_props.ToList();

            if (version == NetInfoVersion.Slope)
            {
                leftRoadProps?.AddLeftWallLights(info.m_pavementWidth);
                rightRoadProps?.AddRightWallLights(info.m_pavementWidth);
            }
            if (leftPedLane != null && leftPedLane.m_laneProps != null)
            {
                leftPedLane.m_laneProps.m_props = leftRoadProps.ToArray();
            }
            if (rightPedLane != null && rightPedLane.m_laneProps != null)
            {
                rightPedLane.m_laneProps.m_props = rightRoadProps.ToArray();
            }
            info.TrimNonHighwayProps(version == NetInfoVersion.Ground);

            ///////////////////////////
            // AI                    //
            ///////////////////////////
            var hwPlayerNetAI = highwayInfo.GetComponent <PlayerNetAI>();
            var playerNetAI   = info.GetComponent <PlayerNetAI>();

            if (hwPlayerNetAI != null && playerNetAI != null)
            {
                playerNetAI.m_constructionCost = hwPlayerNetAI.m_constructionCost * 4 / 3;
                playerNetAI.m_maintenanceCost  = hwPlayerNetAI.m_maintenanceCost * 4 / 3;
            }

            var roadBaseAI = info.GetComponent <RoadBaseAI>();

            if (roadBaseAI != null)
            {
                roadBaseAI.m_highwayRules   = true;
                roadBaseAI.m_trafficLights  = false;
                roadBaseAI.m_accumulateSnow = false;
            }

            var roadAI = info.GetComponent <RoadAI>();

            if (roadAI != null)
            {
                roadAI.m_enableZoning = false;
            }
        }
        private static void SetupTextures(NetInfo info, NetInfoVersion version)
        {
            switch (version)
            {
            case NetInfoVersion.Ground:
            case NetInfoVersion.GroundGrass:
            case NetInfoVersion.GroundTrees:
                var suffix = version.ToString().Substring(6).Length > 0 ? "Grass" : "Concrete";
                info.SetAllSegmentsTexture(
                    new TextureSet
                        (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Ground_Segment__MainTex.png",
                        $@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Ground_Segment{suffix}__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Ground_Segment_LOD__MainTex.png",
                        $@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Ground_Segment{suffix}_LOD__APRMap.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Ground_Segment_LOD__XYSMap.png"));
                info.SetAllNodesTexture(
                    new TextureSet
                        (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Ground_Node__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Ground_Node__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Ground_Node_LOD__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Ground_Node_LOD__APRMap.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Ground_Segment_LOD__XYSMap.png"));
                break;

            case NetInfoVersion.Elevated:
                info.SetAllSegmentsTexture(
                    new TextureSet
                        (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Segment__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Segment__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Segment_LOD__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Segment_LOD__APRMap.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Segment_LOD__XYSMap.png"));
                info.SetAllNodesTexture(
                    new TextureSet
                        (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Node__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Node__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Segment_LOD__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Node_LOD__APRMap.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Segment_LOD__XYSMap.png"));
                break;

            case NetInfoVersion.Bridge:
                for (int i = 0; i < info.m_segments.Length; i++)
                {
                    if (info.m_segments[i].m_mesh.name == "Bridge_Cables")
                    {
                        info.m_segments[i].SetTextures(
                            new TextureSet
                                (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Bridge_Cables__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Bridge_Cables__APRMap.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Bridge_Cables__XYSMap.png"),
                            new LODTextureSet
                                (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Bridge_Cables_LOD__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Bridge_Cables_LOD__APRMap.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Bridge_Cables_LOD__XYSMap.png"));
                    }
                    else
                    {
                        info.m_segments[i].SetTextures(
                            new TextureSet
                                (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Segment__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Segment__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Segment_LOD__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Segment_LOD__APRMap.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Segment_LOD__XYSMap.png"));
                    }
                }

                info.SetAllNodesTexture(
                    new TextureSet
                        (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Node__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Node__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Segment_LOD__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Node_LOD__APRMap.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Elevated_Segment_LOD__XYSMap.png"));
                break;

            case NetInfoVersion.Slope:
                for (int i = 0; i < info.m_segments.Length; i++)
                {
                    if (info.m_segments[i].m_mesh.name == "medium-tunnel-slope")
                    {
                        info.m_segments[i].SetTextures(
                            new TextureSet
                                (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment_Cover__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment_LOD__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment_LOD__APRMap.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment_LOD__XYSMap.png"));
                    }
                    else
                    {
                        info.m_segments[i].SetTextures(
                            new TextureSet
                                (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment_LOD__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment_LOD__APRMap.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment_LOD__XYSMap.png"));
                    }
                }

                for (int i = 0; i < info.m_nodes.Length; i++)
                {
                    if (info.m_nodes[i].m_mesh.name == "Slope_U_Node")
                    {
                        info.m_nodes[i].SetTextures(
                            new TextureSet
                                (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Tunnel_Node__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment_LOD__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment_LOD__APRMap.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment_LOD__XYSMap.png"));
                    }
                    else
                    {
                        info.m_nodes[i].SetTextures(
                            new TextureSet
                                (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Ground_Node__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Ground_Node__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Ground_Node_LOD__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Ground_Node_LOD__APRMap.png",
                                @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Slope_Segment_LOD__XYSMap.png"));
                    }
                }
                break;

            case NetInfoVersion.Tunnel:
            {
                info.SetAllSegmentsTexture(
                    new TextureSet
                        (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Tunnel_Segment__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Tunnel_Segment__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Tunnel_Segment_LOD__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Tunnel_Segment_LOD__APRMap.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Tunnel_Segment_LOD__XYSMap.png"));
                info.SetAllNodesTexture(
                    new TextureSet
                        (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Tunnel_Segment__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Tunnel_Node__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Tunnel_Segment_LOD__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Tunnel_Segment_LOD__APRMap.png",
                        @"Roads\Avenues\LargeAvenue8L2BusLanes\Textures\Tunnel_Segment_LOD__XYSMap.png"));
                break;
            }
            }
        }