本文整理汇总了C#中NetInfo.TrimHighwayProps方法的典型用法代码示例。如果您正苦于以下问题:C# NetInfo.TrimHighwayProps方法的具体用法?C# NetInfo.TrimHighwayProps怎么用?C# NetInfo.TrimHighwayProps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetInfo
的用法示例。
在下文中一共展示了NetInfo.TrimHighwayProps方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildUp
//.........这里部分代码省略.........
// @"NewNetwork\Highway2L\Textures\Elevated_NodeLOD__AlphaMap.png",
// @"NewNetwork\Highway2L\Textures\Elevated_NodeLOD__XYSMap.png"));
break;
case NetInfoVersion.Slope:
info.SetNodesTexture(
new TexturesSet
(@"NewNetwork\Highway2L\Textures\Slope_Node__MainTex.png",
@"NewNetwork\Highway2L\Textures\Slope_Node__AlphaMap.png"),
new TexturesSet
(@"NewNetwork\Highway2L\Textures\Slope_NodeLOD__MainTex.png",
@"NewNetwork\Highway2L\Textures\Slope_NodeLOD__AlphaMap.png",
@"NewNetwork\Highway2L\Textures\Slope_NodeLOD__XYSMap.png"));
break;
case NetInfoVersion.Tunnel:
break;
}
///////////////////////////
// Set up //
///////////////////////////
info.m_availableIn = ItemClass.Availability.All;
info.m_createPavement = (version == NetInfoVersion.Slope);
info.m_createGravel = (version == NetInfoVersion.Ground);
info.m_averageVehicleLaneSpeed = 2f;
info.m_hasParkingSpaces = false;
info.m_hasPedestrianLanes = false;
info.m_UnlockMilestone = highwayInfo.m_UnlockMilestone;
// Disabling Parkings and Peds
foreach (var l in info.m_lanes)
{
switch (l.m_laneType)
{
case NetInfo.LaneType.Parking:
l.m_laneType = NetInfo.LaneType.None;
break;
case NetInfo.LaneType.Pedestrian:
l.m_laneType = NetInfo.LaneType.None;
break;
}
}
// Setting up lanes
var vehiculeLanes = info.m_lanes
.Where(l => l.m_laneType != NetInfo.LaneType.None)
.OrderBy(l => l.m_similarLaneIndex)
.ToArray();
for (int i = 0; i < vehiculeLanes.Length; i++)
{
var l = vehiculeLanes[i];
l.m_allowStop = false;
l.m_speedLimit = 2f;
if (version == NetInfoVersion.Ground)
{
l.m_verticalOffset = 0f;
}
}
if (version == NetInfoVersion.Ground)
{
var hwPlayerNetAI = highwayInfo.GetComponent<PlayerNetAI>();
var playerNetAI = info.GetComponent<PlayerNetAI>();
if (hwPlayerNetAI != null && playerNetAI != null)
{
playerNetAI.m_constructionCost = hwPlayerNetAI.m_constructionCost * 2 / 3;
playerNetAI.m_maintenanceCost = hwPlayerNetAI.m_maintenanceCost * 2 / 3;
}
}
else // Same as the original oneway
{
}
var roadBaseAI = info.GetComponent<RoadBaseAI>();
if (roadBaseAI != null)
{
roadBaseAI.m_highwayRules = true;
roadBaseAI.m_trafficLights = false;
}
var roadAI = info.GetComponent<RoadAI>();
if (roadAI != null)
{
roadAI.m_enableZoning = false;
}
info.SetHighwayProps(highwayInfo);
info.TrimHighwayProps();
}
示例2: BuildUp
//.........这里部分代码省略.........
new TexturesSet
(@"NewNetwork\Highway6L\Textures\Slope_NodeLOD__MainTex.png",
@"NewNetwork\Highway6L\Textures\Slope_NodeLOD__APRMap.png",
@"NewNetwork\Highway6L\Textures\Slope_NodeLOD__XYSMap.png"));
break;
case NetInfoVersion.Tunnel:
break;
}
///////////////////////////
// Set up //
///////////////////////////
info.m_availableIn = ItemClass.Availability.All;
info.m_createPavement = (version == NetInfoVersion.Slope);
info.m_createGravel = (version == NetInfoVersion.Ground);
info.m_averageVehicleLaneSpeed = 2f;
info.m_hasParkingSpaces = false;
info.m_hasPedestrianLanes = false;
info.m_UnlockMilestone = highwayInfo.m_UnlockMilestone;
// Disabling Parkings and Peds
foreach (var l in info.m_lanes)
{
switch (l.m_laneType)
{
case NetInfo.LaneType.Parking:
l.m_laneType = NetInfo.LaneType.None;
break;
case NetInfo.LaneType.Pedestrian:
l.m_laneType = NetInfo.LaneType.None;
break;
}
}
// Setting up lanes
var vehiculeLanes = info.m_lanes
.Where(l => l.m_laneType != NetInfo.LaneType.None)
.OrderBy(l => l.m_similarLaneIndex)
.ToArray();
var nbLanes = vehiculeLanes.Count(); // Supposed to be 6
const float laneWidth = 2f; // TODO: Make it 2.5 with new texture
const float laneWidthPad = 1f;
const float laneWidthTotal = laneWidth + laneWidthPad;
var positionStart = (laneWidthTotal * ((1f - nbLanes) / 2f));
for (int i = 0; i < vehiculeLanes.Length; i++)
{
var l = vehiculeLanes[i];
l.m_allowStop = false;
l.m_speedLimit = 2f;
if (version == NetInfoVersion.Ground)
{
l.m_verticalOffset = 0f;
}
l.m_width = laneWidthTotal;
l.m_position = positionStart + i * laneWidthTotal;
}
if (version == NetInfoVersion.Ground)
{
var hwPlayerNetAI = highwayInfo.GetComponent<PlayerNetAI>();
var playerNetAI = info.GetComponent<PlayerNetAI>();
if (hwPlayerNetAI != null && playerNetAI != null)
{
playerNetAI.m_constructionCost = hwPlayerNetAI.m_constructionCost * 2;
playerNetAI.m_maintenanceCost = hwPlayerNetAI.m_maintenanceCost * 2;
}
}
else // Same as the original oneway
{
}
var roadBaseAI = info.GetComponent<RoadBaseAI>();
if (roadBaseAI != null)
{
roadBaseAI.m_highwayRules = true;
roadBaseAI.m_trafficLights = false;
}
var roadAI = info.GetComponent<RoadAI>();
if (roadAI != null)
{
roadAI.m_enableZoning = false;
}
info.SetHighwayProps(highwayInfo);
info.TrimHighwayProps();
}
示例3: BuildUp
//.........这里部分代码省略.........
break;
case NetInfoVersion.Tunnel:
break;
}
///////////////////////////
// Set up //
///////////////////////////
var highwayInfo = ToolsCSL.FindPrefab<NetInfo>("Highway");
info.m_createPavement = (version != NetInfoVersion.Ground);
info.m_createGravel = (version == NetInfoVersion.Ground);
info.m_averageVehicleLaneSpeed = 2f;
info.m_hasParkingSpaces = false;
info.m_hasPedestrianLanes = false;
info.m_UnlockMilestone = highwayInfo.m_UnlockMilestone;
// Activate with a new mesh
//info.m_class = highwayInfo.m_class;
// Test
//info.m_surfaceLevel = 0;
// Disabling Parkings and Peds
foreach (var l in info.m_lanes)
{
switch (l.m_laneType)
{
case NetInfo.LaneType.Parking:
l.m_laneType = NetInfo.LaneType.None;
break;
case NetInfo.LaneType.Pedestrian:
l.m_laneType = NetInfo.LaneType.None;
break;
}
}
// Setting up lanes
var vehiculeLanes = info.m_lanes
.Where(l => l.m_laneType != NetInfo.LaneType.None)
.OrderBy(l => l.m_similarLaneIndex)
.ToArray();
var nbLanes = vehiculeLanes.Count(); // Supposed to be 6
const float laneWidth = 2f; // TODO: Make it 2.5 with new texture
const float laneWidthPad = 1f;
const float laneWidthTotal = laneWidth + laneWidthPad;
var positionStart = (laneWidthTotal * ((1f - nbLanes) / 2f));
for (int i = 0; i < vehiculeLanes.Length; i++)
{
var l = vehiculeLanes[i];
l.m_allowStop = false;
l.m_speedLimit = 2f;
//l.m_verticalOffset = 0f;
l.m_width = laneWidthTotal;
l.m_position = positionStart + i * laneWidthTotal;
}
if (version == NetInfoVersion.Ground)
{
var hwPlayerNetAI = highwayInfo.GetComponent<PlayerNetAI>();
var playerNetAI = info.GetComponent<PlayerNetAI>();
if (hwPlayerNetAI != null && playerNetAI != null)
{
playerNetAI.m_constructionCost = hwPlayerNetAI.m_constructionCost * 2;
playerNetAI.m_maintenanceCost = hwPlayerNetAI.m_maintenanceCost * 2;
}
}
else // Same as the original oneway
{
}
var roadBaseAI = info.GetComponent<RoadBaseAI>();
if (roadBaseAI != null)
{
roadBaseAI.m_highwayRules = true;
roadBaseAI.m_trafficLights = false;
}
var roadAI = info.GetComponent<RoadAI>();
if (roadAI != null)
{
roadAI.m_enableZoning = false;
roadAI.m_trafficLights = false;
}
info.SetHighwayProps(highwayInfo);
info.TrimHighwayProps();
}