HandleAsymSegmentFlags() public static method

public static HandleAsymSegmentFlags ( this segment, LanesLayoutStyle asymLaneType ) : void
segment this
asymLaneType LanesLayoutStyle
return void
        public static NetInfo Setup8m1p5mSW1SMesh(this NetInfo info, NetInfoVersion version, LanesLayoutStyle laneStyle = LanesLayoutStyle.Symmetrical)
        {
            switch (version)
            {
            case NetInfoVersion.Ground:
            {
                var segments0 = info.m_segments[0].ShallowClone();
                var nodes0    = info.m_nodes[0].ShallowClone();
                var nodes1    = info.m_nodes[0].ShallowClone();
                var nodes2    = info.m_nodes[0].ShallowClone();
                segments0
                .SetFlagsDefault()
                .SetMeshes
                    (@"Roads\Common\Meshes\8m\1p5mSW1S\Ground.obj",
                    @"Roads\Common\Meshes\8m\1p5mSW1S\Ground_LOD.obj");

                nodes0
                .SetMeshes
                    (@"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node.obj",
                    @"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node_LOD.obj");

                nodes1
                .SetMeshes
                    (@"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node2.obj",
                    @"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node_LOD.obj");
                nodes2
                .SetMeshes
                    (@"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node3.obj",
                    @"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node_LOD.obj");

                if (laneStyle != LanesLayoutStyle.Symmetrical)
                {
                    RoadHelper.HandleAsymSegmentFlags(segments0);
                }

                nodes1.m_directConnect = true;
                nodes1.m_connectGroup  = NetInfo.ConnectGroup.NarrowTram | NetInfo.ConnectGroup.OnewayStart | NetInfo.ConnectGroup.OnewayEnd;
                nodes2.m_directConnect = true;
                nodes2.m_connectGroup  = NetInfo.ConnectGroup.NarrowTram | NetInfo.ConnectGroup.OnewayEnd;
                info.m_segments        = new[] { segments0 };
                info.m_nodes           = new[] { nodes0, nodes1 };
                break;
            }
            }
            return(info);
        }
Exemplo n.º 2
0
        public static NetInfo Setup8m1p5mSWMesh(this NetInfo info, NetInfoVersion version, LanesLayoutStyle laneStyle = LanesLayoutStyle.Symmetrical)
        {
            switch (version)
            {
            case NetInfoVersion.Ground:
            {
                var segments0 = info.m_segments[0].ShallowClone();
                var nodes0    = info.m_nodes[0].ShallowClone();
                var nodes1    = info.m_nodes[0].ShallowClone();

                segments0
                .SetFlagsDefault()
                .SetMeshes
                    (@"Roads\Common\Meshes\8m\1p5mSW\Ground.obj",
                    @"Roads\Common\Meshes\8m\1p5mSW\Ground_LOD.obj");

                nodes0
                .SetFlags(NetNode.Flags.None, NetNode.Flags.Transition)
                .SetMeshes
                    (@"Roads\Common\Meshes\8m\1p5mSW\Ground_Node.obj",
                    @"Roads\Common\Meshes\8m\1p5mSW\Ground_Node_LOD.obj");

                nodes1
                .SetFlags(NetNode.Flags.Transition, NetNode.Flags.None)
                .SetMeshes
                    (@"Roads\Common\Meshes\8m\1p5mSW\Ground_Trans.obj",
                    @"Roads\Common\Meshes\8m\1p5mSW\Ground_Node_LOD.obj");

                if (laneStyle != LanesLayoutStyle.Symmetrical)
                {
                    RoadHelper.HandleAsymSegmentFlags(segments0);
                }

                info.m_segments = new[] { segments0 };
                info.m_nodes    = new[] { nodes0, nodes1 };
                break;
            }
            }
            return(info);
        }
        public static NetInfo Setup16m2mSWMesh(this NetInfo info, NetInfoVersion version, LanesLayoutStyle laneStyle = LanesLayoutStyle.Symmetrical)
        {
            var highwayInfo      = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L);
            var highwaySlopeInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L_SLOPE);
            var defaultMaterial  = highwayInfo.m_nodes[0].m_material;

            switch (version)
            {
            case NetInfoVersion.Ground:
            {
                var segment0 = info.m_segments[0];
                var segment1 = info.m_segments[1];
                var segment2 = info.m_segments[2];
                var segment3 = info.m_segments[1].ShallowClone();

                if (laneStyle != LanesLayoutStyle.Symmetrical)
                {
                    RoadHelper.HandleAsymSegmentFlags(segment1, segment3);
                }
                var node0 = info.m_nodes[0].ShallowClone();

                segment0
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\2mSW\Ground.obj",
                    @"Roads\Common\Meshes\16m\2mSW\Ground_LOD.obj");
                segment1
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\2mSW\Ground.obj",
                    @"Roads\Common\Meshes\16m\2mSW\Ground_LOD.obj");
                segment2
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\2mSW\Ground.obj",
                    @"Roads\Common\Meshes\16m\2mSW\Ground_LOD.obj");
                segment3
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\2mSW\Ground.obj",
                    @"Roads\Common\Meshes\16m\2mSW\Ground_LOD.obj");
                node0
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\2mSW\Ground_Node.obj",
                    @"Roads\Common\Meshes\16m\2mSW\Ground_Node_LOD.obj");

                RoadHelper.HandleAsymSegmentFlags(segment0);
                RoadHelper.HandleAsymSegmentFlags(segment2);

                info.m_segments = new[] { segment0, segment1, segment2, segment3 };
                info.m_nodes    = new[] { node0 };

                break;
            }

            case NetInfoVersion.Elevated:
            case NetInfoVersion.Bridge:
            {
                var segment0 = info.m_segments[0];
                var node0    = info.m_nodes[0];

                segment0
                .SetFlagsDefault()
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\2mSW\Elevated.obj",
                    @"Roads\Common\Meshes\16m\2mSW\Elevated_LOD.obj");

                node0.
                SetMeshes
                    (@"Roads\Common\Meshes\16m\2mSW\Elevated_Node.obj",
                    @"Roads\Common\Meshes\16m\2mSW\Elevated_Node_LOD.obj");

                RoadHelper.HandleAsymSegmentFlags(segment0);
                info.m_segments = new[] { segment0 };
                info.m_nodes    = new[] { node0 };
                break;
            }

            case NetInfoVersion.Slope:
            {
                var segment0 = info.m_segments[0];
                var segment1 = highwaySlopeInfo.m_segments[1].ShallowClone();
                var segment2 = info.m_segments[1];

                var node0 = info.m_nodes[0];
                var node1 = info.m_nodes[1];
                var node2 = node0.ShallowClone();
                //segment0
                //    .SetFlagsDefault()
                //    **ToDo

                segment2
                .SetFlagsDefault()
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\2mSW\Slope.obj",
                    @"Roads\Common\Meshes\16m\2mSW\Slope_LOD.obj");

                node1
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\2mSW\Slope_Node.obj",
                    @"Roads\Common\Meshes\16m\2mSW\Slope_Node_LOD.obj");

                node2
                .SetFlags(NetNode.Flags.Underground, NetNode.Flags.None)
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\2mSW\Slope_U_Node.obj",
                    @"Roads\Common\Meshes\16m\2mSW\Slope_U_Node_LOD.obj");

                RoadHelper.HandleAsymSegmentFlags(segment2);
                node2.m_material = defaultMaterial;

                info.m_segments = new[] { segment0, segment1, segment2 };
                info.m_nodes    = new[] { node0, node1, node2 };

                break;
            }

            case NetInfoVersion.Tunnel:
            {
                var segment0 = info.m_segments[0];
                var segment1 = segment0.ShallowClone();

                var node0 = info.m_nodes[0];
                var node1 = node0.ShallowClone();

                segment1
                .SetFlagsDefault()
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\2mSW\Tunnel.obj",
                    @"Roads\Common\Meshes\16m\2mSW\Tunnel_LOD.obj");

                node1
                .SetFlags(NetNode.Flags.None, NetNode.Flags.None)
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\2mSW\Tunnel_Node.obj",
                    @"Roads\Common\Meshes\16m\2mSW\Tunnel_Node_LOD.obj");

                RoadHelper.HandleAsymSegmentFlags(segment1);
                segment1.m_material = defaultMaterial;
                node1.m_material    = defaultMaterial;

                info.m_segments = new[] { segment0, segment1 };
                info.m_nodes    = new[] { node0, node1 };

                break;
            }
            }
            return(info);
        }
Exemplo n.º 4
0
        public static NetInfo Setup32m5mSW3mMdn(this NetInfo info, NetInfoVersion version, LanesLayoutStyle layoutStyle = LanesLayoutStyle.Symmetrical)
        {
            var highwayInfo     = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L);
            var defaultMaterial = highwayInfo.m_nodes[0].m_material;

            //var inverted = string.Empty;
            //if (L > R)
            //{
            //    inverted = "_Inverted";
            //}
            switch (version)
            {
            case NetInfoVersion.Ground:
            {
                var segments0 = info.m_segments[0];
                var segments1 = info.m_segments[1];
                var segments2 = info.m_segments[2];
                var segments3 = info.m_segments[1].ShallowClone();
                segments0.SetMeshes(
                    @"Roads\Common\Meshes\32m\5mSw3mMdn\Ground.obj");
                segments1.SetMeshes(
                    @"Roads\Common\Meshes\32m\5mSw3mMdn\Bus.obj");
                segments2.SetMeshes(
                    @"Roads\Common\Meshes\32m\5mSw3mMdn\BusBoth.obj");
                segments3.SetMeshes(
                    @"Roads\Common\Meshes\32m\5mSw3mMdn\BusInv.obj");
                if (layoutStyle != LanesLayoutStyle.Symmetrical)
                {
                    RoadHelper.HandleAsymSegmentFlags(segments3, segments1);
                    RoadHelper.HandleAsymSegmentFlags(segments0);
                }

                info.m_segments = new[] { segments0, segments1, segments2, segments3 };
                break;
            }

            case NetInfoVersion.Elevated:
            {
                var segments0 = info.m_segments[0];

                segments0
                .SetMeshes
                    ($@"Roads\Common\Meshes\32m\5mSw3mMdn\Elevated.obj");

                if (layoutStyle != LanesLayoutStyle.Symmetrical)
                {
                    RoadHelper.HandleAsymSegmentFlags(segments0);
                }

                info.m_segments = new[] { segments0 };
                break;
            }

            case NetInfoVersion.Bridge:
            {
                var segments0 = info.m_segments[0];
                var segments1 = info.m_segments[1];

                segments0
                .SetMeshes
                    ($@"Roads\Common\Meshes\32m\5mSw3mMdn\Elevated.obj");

                if (layoutStyle != LanesLayoutStyle.Symmetrical)
                {
                    RoadHelper.HandleAsymSegmentFlags(segments0);
                }

                info.m_segments = new[] { segments0, segments1 };
                //info.m_nodes = new[] { nodes0 };
                break;
            }

            case NetInfoVersion.Slope:
            {
                var segment0 = info.m_segments[0];
                var segment1 = info.m_segments[1].ShallowClone();
                var segment2 = info.m_segments[1].ShallowClone();
                var node0    = info.m_nodes[0];
                var node1    = info.m_nodes[1];
                var node2    = node0.ShallowClone();

                segment1
                .SetMeshes
                    ($@"Roads\Common\Meshes\32m\5mSw3mMdn\Slope.obj",
                    @"Roads\Common\Meshes\32m\3mSw2mMdn\Slope_LOD.obj");
                node2
                .SetFlags(NetNode.Flags.Underground, NetNode.Flags.None)
                .SetMeshes
                    (@"Roads\Common\Meshes\32m\5mSw3mMdn\Slope_U_Node.obj",
                    @"Roads\Common\Meshes\32m\5mSW\Slope_U_Node.obj");

                RoadHelper.HandleAsymSegmentFlags(segment1);
                node2.m_material = defaultMaterial;

                info.m_segments = new[] { segment0, segment1, segment2 };
                info.m_nodes    = new[] { node0, node1, node2 };

                break;
            }

            case NetInfoVersion.Tunnel:
            {
                var segments0 = info.m_segments[0];
                var segments1 = segments0.ShallowClone();
                var segments2 = segments0.ShallowClone();
                var nodes0    = info.m_nodes[0];
                var nodes1    = nodes0.ShallowClone();

                segments1
                .SetMeshes
                    ($@"Roads\Common\Meshes\32m\5mSw3mMdn\Tunnel.obj");
                segments2
                .SetMeshes
                    ($@"Roads\Common\Meshes\32m\5mSw3mMdn\Tunnel_Inverted.obj");
                nodes1
                .SetFlags(NetNode.Flags.None, NetNode.Flags.None)
                .SetMeshes
                    (@"Roads\Common\Meshes\32m\5mSw3mMdn\Tunnel_Node.obj",
                    @"Roads\Highways\Common\Meshes\32m\Tunnel_LOD.obj");

                if (layoutStyle != LanesLayoutStyle.Symmetrical)
                {
                    RoadHelper.HandleAsymSegmentFlags(segments1, segments2);
                }
                segments1.m_material = defaultMaterial;
                nodes1.m_material    = defaultMaterial;

                info.m_segments = new[] { segments0, segments1, segments2 };
                info.m_nodes    = new[] { nodes0, nodes1 };

                break;
            }
            }
            return(info);
        }
        public static NetInfo Setup16m3mSWMesh(this NetInfo info, NetInfoVersion version, LanesLayoutStyle lanesLayoutStyle = LanesLayoutStyle.Symmetrical)
        {
            var highwayInfo      = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L);
            var highwaySlopeInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L_SLOPE);
            var defaultMaterial  = highwayInfo.m_nodes[0].m_material;

            switch (version)
            {
            case NetInfoVersion.Ground:
            case NetInfoVersion.GroundGrass:
            case NetInfoVersion.GroundTrees:
            {
                var segments0 = info.m_segments[0].ShallowClone();
                var segments1 = info.m_segments[1].ShallowClone();
                var segments2 = info.m_segments[2].ShallowClone();
                if (lanesLayoutStyle != LanesLayoutStyle.Symmetrical)
                {
                    var segments3 = info.m_segments[1].ShallowClone();

                    segments3.SetMeshes(@"Roads\Common\Meshes\16m\3mSW\BusStopInv.obj");

                    RoadHelper.HandleAsymSegmentFlags(segments1, segments3);
                    RoadHelper.HandleAsymSegmentFlags(segments0);
                    RoadHelper.HandleAsymSegmentFlags(segments2);


                    info.m_segments = new[] { segments0, segments1, segments2, segments3 };
                }
                else
                {
                    info.m_segments = new[] { segments0, segments1, segments2 };
                }
                break;
            }

            case NetInfoVersion.Elevated:
            case NetInfoVersion.Bridge:
            {
                var segments0 = info.m_segments[0].ShallowClone();
                var nodes0    = info.m_nodes[0].ShallowClone();

                segments0
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\3mSW\Elevated.obj",
                    @"Roads\Common\Meshes\16m\3mSW\Elevated_LOD.obj");

                nodes0.SetMeshes
                    (@"Roads\Common\Meshes\16m\3mSW\Elevated_Node.obj",
                    @"Roads\Common\Meshes\16m\3mSW\Elevated_Node_LOD.obj");

                RoadHelper.HandleAsymSegmentFlags(segments0);
                info.m_segments = new[] { segments0 };
                info.m_nodes    = new[] { nodes0 };
                break;
            }

            case NetInfoVersion.Slope:
            {
                var segment0 = info.m_segments[0].ShallowClone();
                var segment1 = highwaySlopeInfo.m_segments[1].ShallowClone();
                var segment2 = info.m_segments[1].ShallowClone();

                var node0 = info.m_nodes[0].ShallowClone();
                var node1 = info.m_nodes[1].ShallowClone();
                var node2 = node0.ShallowClone();

                segment2
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\3mSW\Slope.obj",
                    @"Roads\Common\Meshes\16m\3mSW\Slope_LOD.obj")
                .SetConsistentUVs();

                node1
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\3mSW\Slope_Node.obj",
                    @"Roads\Common\Meshes\16m\3mSW\Slope_Node_LOD.obj");

                node2
                .SetFlags(NetNode.Flags.Underground, NetNode.Flags.None)
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\3mSW\Slope_U_Node.obj",
                    @"Roads\Common\Meshes\16m\3mSW\Slope_U_Node_LOD.obj");

                RoadHelper.HandleAsymSegmentFlags(segment2);
                node2.m_material = defaultMaterial;

                info.m_segments = new[] { segment0, segment1, segment2 };
                info.m_nodes    = new[] { node0, node1, node2 };

                break;
            }

            case NetInfoVersion.Tunnel:
            {
                var segments0 = info.m_segments[0].ShallowClone();
                var segments1 = segments0.ShallowClone();

                var nodes0 = info.m_nodes[0].ShallowClone();
                var nodes1 = nodes0.ShallowClone();

                segments1
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\3mSW\Tunnel.obj",
                    @"Roads\Common\Meshes\16m\3mSW\Tunnel_LOD.obj")
                .SetConsistentUVs();

                nodes1
                .SetFlags(NetNode.Flags.None, NetNode.Flags.None)
                .SetMeshes
                    (@"Roads\Common\Meshes\16m\3mSW\Tunnel_Node.obj",
                    @"Roads\Common\Meshes\16m\3mSW\Tunnel_Node_LOD.obj");

                RoadHelper.HandleAsymSegmentFlags(segments1);
                segments1.m_material = defaultMaterial;
                nodes1.m_material    = defaultMaterial;

                info.m_segments = new[] { segments0, segments1 };
                info.m_nodes    = new[] { nodes0, nodes1 };

                break;
            }
            }
            return(info);
        }