本文整理汇总了C#中NetInfo.TrimNonHighwayProps方法的典型用法代码示例。如果您正苦于以下问题:C# NetInfo.TrimNonHighwayProps方法的具体用法?C# NetInfo.TrimNonHighwayProps怎么用?C# NetInfo.TrimNonHighwayProps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetInfo
的用法示例。
在下文中一共展示了NetInfo.TrimNonHighwayProps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildUp
//.........这里部分代码省略.........
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();
rightHwLaneProps.AddRightWallLights();
}
leftHwLaneProps.RemoveProps("100 Speed Limit"); // Since we dont have the 90km/h limit prop
rightHwLaneProps.RemoveProps("100 Speed Limit"); // Since we dont have the 90km/h limit prop
leftHwLane.m_laneProps.m_props = leftHwLaneProps.ToArray();
rightHwLane.m_laneProps.m_props = rightHwLaneProps.ToArray();
info.TrimNonHighwayProps(version == NetInfoVersion.Ground);
///////////////////////////
// AI //
///////////////////////////
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;
}
var roadBaseAI = info.GetComponent<RoadBaseAI>();
if (roadBaseAI != null)
{
roadBaseAI.m_highwayRules = true;
roadBaseAI.m_trafficLights = false;
roadBaseAI.m_accumulateSnow = false;
}
var roadAI = info.GetComponent<RoadAI>();
if (roadAI != null)
{
roadAI.m_enableZoning = false;
}
}
示例2: 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);
///////////////////////////
// 3DModeling //
///////////////////////////
info.Setup24mMesh(version);
///////////////////////////
// Texturing //
///////////////////////////
SetupTextures(info, version);
///////////////////////////
// Set up //
///////////////////////////
info.m_availableIn = ItemClass.Availability.All;
//info.m_class = highwayInfo.m_class.Clone(NetInfoClasses.NEXT_HIGHWAY4L);
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_UnlockMilestone = highwayInfo.m_UnlockMilestone;
info.m_halfWidth = (version == NetInfoVersion.Bridge || version == NetInfoVersion.Elevated) ? 11 : 12;
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_HIGHWAY4L_TUNNEL);
}
else
{
info.m_class = highwayInfo.m_class.Clone(NetInfoClasses.NEXT_HIGHWAY4L);
}
///////////////////////////
// Set up lanes //
///////////////////////////
info.SetupHighwayLanes();
var leftHwLane = info.SetHighwayLeftShoulder(highwayInfo, version);
var rightHwLane = info.SetHighwayRightShoulder(highwayInfo, version);
var vehicleLanes = info.SetHighwayVehicleLanes(1);
///////////////////////////
// Set up props //
///////////////////////////
var leftHwLaneProps = leftHwLane.m_laneProps.m_props.ToList();
var rightHwLaneProps = rightHwLane.m_laneProps.m_props.ToList();
if (version == NetInfoVersion.Slope)
{
leftHwLaneProps.SetHighwaySignsSlope();
rightHwLaneProps.SetHighwaySignsSlope();
}
// Lightning
rightHwLaneProps.SetHighwayRightLights(version);
if (version == NetInfoVersion.Slope)
{
leftHwLaneProps.AddLeftWallLights(1);
rightHwLaneProps.AddRightWallLights(-1);
}
leftHwLane.m_laneProps.m_props = leftHwLaneProps.ToArray();
rightHwLane.m_laneProps.m_props = rightHwLaneProps.ToArray();
info.TrimNonHighwayProps();
///////////////////////////
// AI //
///////////////////////////
var hwPlayerNetAI = highwayInfo.GetComponent<PlayerNetAI>();
var playerNetAI = info.GetComponent<PlayerNetAI>();
if (hwPlayerNetAI != null && playerNetAI != null)
{
playerNetAI.m_constructionCost = hwPlayerNetAI.m_constructionCost * 4 / 3;
playerNetAI.m_maintenanceCost = hwPlayerNetAI.m_maintenanceCost * 4 / 3;
}
var roadBaseAI = info.GetComponent<RoadBaseAI>();
if (roadBaseAI != null)
{
roadBaseAI.m_highwayRules = true;
roadBaseAI.m_trafficLights = false;
roadBaseAI.m_accumulateSnow = false;
//.........这里部分代码省略.........