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


C# NetInfo.ReplaceProps方法代码示例

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


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

示例1: BuildUp

        public void BuildUp(NetInfo info, NetInfoVersion version)
        {
            ///////////////////////////
            // Template              //
            ///////////////////////////
            var roadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ONEWAY_2L);

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

            ///////////////////////////
            // Texturing             //
            ///////////////////////////
            switch (version)
            {
                case NetInfoVersion.Ground:
                    info.SetAllSegmentsTexture(
                        new TextureSet
                           (@"Roads\TinyRoads\OneWay1L\Textures\Ground_Segment__MainTex.png",
                            @"Roads\TinyRoads\OneWay1L\Textures\Ground_Segment__APRMap.png"),
                        new LODTextureSet
                           (@"Roads\TinyRoads\OneWay1L\Textures\Ground_Segment_LOD__MainTex.png",
                            @"Roads\TinyRoads\OneWay1L\Textures\Ground_Segment_LOD__APRMap.png",
                            @"Roads\TinyRoads\OneWay1L\Textures\Ground_LOD__XYSMap.png"));

                    info.SetAllNodesTexture(
                        new TextureSet
                            (@"Roads\TinyRoads\OneWay1L\Textures\Ground_Node__MainTex.png",
                             @"Roads\TinyRoads\OneWay1L\Textures\Ground_Node__APRMap.png"),
                        new LODTextureSet
                           (@"Roads\TinyRoads\OneWay1L\Textures\Ground_Node_LOD__MainTex.png",
                            @"Roads\TinyRoads\OneWay1L\Textures\Ground_Node_LOD__APRMap.png",
                            @"Roads\TinyRoads\OneWay1L\Textures\Ground_LOD__XYSMap.png"));
                    break;
            }

            ///////////////////////////
            // Set up                //
            ///////////////////////////
            info.m_hasParkingSpaces = false;
            info.m_halfWidth = 4f;
            info.m_pavementWidth = 2f;
            info.m_class = roadInfo.m_class.Clone("NExt1LOneway");

            info.m_lanes = info.m_lanes
                .Where(l => l.m_laneType != NetInfo.LaneType.Parking)
                .ToArray();

            info.SetRoadLanes(version, new LanesConfiguration
            {
                IsTwoWay = true,
                LaneWidth = 4f,
                LanesToAdd = -1,
                SpeedLimit = 0.6f,
                BusStopOffset = 0f,
                PedLaneOffset = -0.75f,
                PedPropOffsetX = 2.25f
            });
            info.SetupNewSpeedLimitProps(30, 40);

            // left traffic light
            var newLeftTrafficLight = Prefabs.Find<PropInfo>("Traffic Light 01", false);
            var oldLeftTrafficLight = Prefabs.Find<PropInfo>("Traffic Light 02 Mirror", false);

            if (newLeftTrafficLight == null || oldLeftTrafficLight == null)
            {
                return;
            }

            info.ReplaceProps(newLeftTrafficLight, oldLeftTrafficLight);

            var originPlayerNetAI = roadInfo.GetComponent<PlayerNetAI>();
            var playerNetAI = info.GetComponent<PlayerNetAI>();

            if (playerNetAI != null && originPlayerNetAI != null)
            {
                playerNetAI.m_constructionCost = originPlayerNetAI.m_constructionCost * 1 / 2;
                playerNetAI.m_maintenanceCost = originPlayerNetAI.m_maintenanceCost * 1 / 2;
            }

            var roadBaseAI = info.GetComponent<RoadBaseAI>();
            if (roadBaseAI != null)
            {
                roadBaseAI.m_trafficLights = false;
            }
        }
开发者ID:Katalyst6,项目名称:CSL.TransitAddonMod,代码行数:88,代码来源:OneWAy1LBuilder.cs


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