当前位置: 首页>>代码示例>>C#>>正文


C# NetInfo.Setup16mMesh方法代码示例

本文整理汇总了C#中NetInfo.Setup16mMesh方法的典型用法代码示例。如果您正苦于以下问题:C# NetInfo.Setup16mMesh方法的具体用法?C# NetInfo.Setup16mMesh怎么用?C# NetInfo.Setup16mMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NetInfo的用法示例。


在下文中一共展示了NetInfo.Setup16mMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildUp

        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);
            var basicRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_2L);


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

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


            ///////////////////////////
            // Set up                //
            ///////////////////////////
            info.m_availableIn = ItemClass.Availability.All;
            info.m_class = highwayInfo.m_class.Clone(NetInfoClasses.NEXT_HIGHWAY1L);
            info.m_surfaceLevel = 0;
            info.m_createPavement = version != NetInfoVersion.Ground && version != NetInfoVersion.Tunnel;
            info.m_createGravel = version == NetInfoVersion.Ground;
            info.m_averageVehicleLaneSpeed = 2f;
            info.m_hasParkingSpaces = false;
            info.m_hasPedestrianLanes = false;
            info.m_halfWidth = 8;
            info.m_UnlockMilestone = highwayInfo.m_UnlockMilestone;
            info.m_pavementWidth = 2;
            if (version == NetInfoVersion.Tunnel)
            {
                info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground;
                info.m_class = highwayTunnelInfo.m_class.Clone(NetInfoClasses.NEXT_HIGHWAY1L_TUNNEL);
            }
            else
            {
                info.m_class = highwayInfo.m_class.Clone(NetInfoClasses.NEXT_HIGHWAY1L);
            }

            ///////////////////////////
            // Set up lanes          //
            ///////////////////////////
            info.SetupHighwayLanes();
            var leftHwLane = info.SetHighwayLeftShoulder(highwayInfo, version);
            var rightHwLane = info.SetHighwayRightShoulder(highwayInfo, version);
            var vehicleLanes = info.SetHighwayVehicleLanes();

            foreach (var lane in vehicleLanes)
            {
                lane.m_speedLimit = 1.8f;
            }

            ///////////////////////////
            // Set up props          //
            ///////////////////////////

            // Shoulder lanes ---------------------------------------------------------------------
            var leftHwLaneProps = leftHwLane.m_laneProps.m_props.ToList();
            var rightHwLaneProps = rightHwLane.m_laneProps.m_props.ToList();

            foreach (var prop in leftHwLaneProps.Where(lp => lp.m_flagsForbidden == NetLane.Flags.Inverted))
            {
                prop.m_startFlagsForbidden = NetNode.Flags.None;
                prop.m_startFlagsRequired = NetNode.Flags.None;
                prop.m_endFlagsForbidden = NetNode.Flags.None;
                prop.m_endFlagsRequired = NetNode.Flags.Transition;
                prop.m_angle = 180;
                prop.m_position.z *= -1;
                prop.m_segmentOffset *= -1;
            }


            // Set traffic lights
            leftHwLaneProps.Trim(lp => 
                lp != null &&
                lp.m_prop != null &&
                lp.m_prop.name != null &&
                lp.m_prop.name.Contains("Traffic"));
            rightHwLaneProps.Trim(lp =>
                lp != null &&
                lp.m_prop != null &&
                lp.m_prop.name != null &&
                lp.m_prop.name.Contains("Traffic"));

            leftHwLaneProps.AddRange(basicRoadInfo.GetLeftTrafficLights(version));
            rightHwLaneProps.AddRange(basicRoadInfo.GetRightTrafficLights(version));


            // Lightning
            rightHwLaneProps.SetHighwayRightLights(version);
            if (version == NetInfoVersion.Slope)
            {
                leftHwLaneProps.AddLeftWallLights();
//.........这里部分代码省略.........
开发者ID:Katalyst6,项目名称:CSL.TransitAddonMod,代码行数:101,代码来源:Highway1LBuilder.cs


注:本文中的NetInfo.Setup16mMesh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。