本文整理汇总了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;
}
}