本文整理汇总了C#中NetInfo.SetRoadLanes方法的典型用法代码示例。如果您正苦于以下问题:C# NetInfo.SetRoadLanes方法的具体用法?C# NetInfo.SetRoadLanes怎么用?C# NetInfo.SetRoadLanes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetInfo
的用法示例。
在下文中一共展示了NetInfo.SetRoadLanes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildUp
public void BuildUp(NetInfo info, NetInfoVersion version)
{
///////////////////////////
// Template //
///////////////////////////
var owRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ONEWAY_2L);
var owRoadTunnelInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ONEWAY_2L_TUNNEL);
///////////////////////////
// 3DModeling //
///////////////////////////
info.Setup16m3mSWMesh(version);
///////////////////////////
// Texturing //
///////////////////////////
SetupTextures(info, version);
///////////////////////////
// Set up //
///////////////////////////
info.m_hasParkingSpaces = false;
info.m_pavementWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 3 : 6);
info.m_halfWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 8 : 11);
if (version == NetInfoVersion.Tunnel)
{
info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground;
info.m_setCitizenFlags = CitizenInstance.Flags.Transition | CitizenInstance.Flags.Underground;
info.m_class = owRoadTunnelInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL3L_ROAD_TUNNEL);
}
else
{
info.m_class = owRoadInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL3L_ROAD);
}
// Setting up lanes
info.SetRoadLanes(version, new LanesConfiguration
{
IsTwoWay = false,
LanesToAdd = 1,
LaneWidth = 3.3f,
SpeedLimit = 1.2f
});
var leftPedLane = info.GetLeftRoadShoulder();
var rightPedLane = info.GetRightRoadShoulder();
//Setting Up Props
var leftRoadProps = leftPedLane.m_laneProps.m_props.ToList();
var rightRoadProps = rightPedLane.m_laneProps.m_props.ToList();
if (version == NetInfoVersion.Slope)
{
leftRoadProps.AddLeftWallLights(info.m_pavementWidth);
rightRoadProps.AddRightWallLights(info.m_pavementWidth);
}
leftPedLane.m_laneProps.m_props = leftRoadProps.ToArray();
rightPedLane.m_laneProps.m_props = rightRoadProps.ToArray();
info.TrimAboveGroundProps(version);
info.SetupNewSpeedLimitProps(60, 40);
// AI
var owPlayerNetAI = owRoadInfo.GetComponent<PlayerNetAI>();
var playerNetAI = info.GetComponent<PlayerNetAI>();
if (owPlayerNetAI != null && playerNetAI != null)
{
playerNetAI.m_constructionCost = owPlayerNetAI.m_constructionCost * 3 / 2; // Charge by the lane?
playerNetAI.m_maintenanceCost = owPlayerNetAI.m_maintenanceCost * 3 / 2; // Charge by the lane?
}
var roadBaseAI = info.GetComponent<RoadBaseAI>();
if (roadBaseAI != null)
{
roadBaseAI.m_trafficLights = true;
}
}
示例2: BuildUp
public void BuildUp(NetInfo info, NetInfoVersion version)
{
///////////////////////////
// Template //
///////////////////////////
var roadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_6L);
var roadTunnelInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_6L_TUNNEL);
var bridgeInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_4L_BRIDGE).Clone("temp");
///////////////////////////
// 3DModeling //
///////////////////////////
info.Setup32m5mSWMesh(version);
///////////////////////////
// Texturing //
///////////////////////////
SetupTextures(info, version);
///////////////////////////
// Set up //
///////////////////////////
info.m_hasParkingSpaces = true;
info.m_pavementWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 5 : 7);
info.m_halfWidth = (version == NetInfoVersion.Bridge || version == NetInfoVersion.Elevated ? 14 : 16);
if (version == NetInfoVersion.Tunnel)
{
info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground;
info.m_setCitizenFlags = CitizenInstance.Flags.Transition | CitizenInstance.Flags.Underground;
info.m_class = roadTunnelInfo.m_class.Clone(NetInfoClasses.NEXT_MEDIUM_ROAD_TUNNEL);
}
else if (version == NetInfoVersion.Bridge)
{
info.m_class = bridgeInfo.m_class.Clone(NetInfoClasses.NEXT_MEDIUM_ROAD);
}
else
{
info.m_class = roadInfo.m_class.Clone(NetInfoClasses.NEXT_MEDIUM_ROAD);
}
// Setting up lanes
info.SetRoadLanes(version, new LanesConfiguration
{
IsTwoWay = true,
LanesToAdd = -2,
LaneWidth = 3.8f,
BusStopOffset = 2.9f,
CenterLane = CenterLaneType.Median,
CenterLaneWidth = 3.8f
});
var leftPedLane = info.GetLeftRoadShoulder();
var rightPedLane = info.GetRightRoadShoulder();
// Fix for T++ legacy support
if (version == NetInfoVersion.Ground)
{
var lanes = info.m_lanes.OrderBy(l => l.m_position).ToArray();
var lanesLegacyOrder = new[]
{
lanes[2],
lanes[3],
lanes[4],
lanes[5],
lanes[0],
lanes[7],
lanes[1],
lanes[6]
};
info.m_lanes = lanesLegacyOrder;
}
//Setting Up Props
var leftRoadProps = leftPedLane.m_laneProps.m_props.ToList();
var rightRoadProps = rightPedLane.m_laneProps.m_props.ToList();
if (version != NetInfoVersion.Tunnel)
{
var leftStreetLight = leftRoadProps.FirstOrDefault(p => p.m_prop.name.ToLower().Contains("new street light"));
if (leftStreetLight != null)
{
leftStreetLight.m_finalProp =
leftStreetLight.m_prop = Prefabs.Find<PropInfo>(MediumAvenueSideLightBuilder.NAME);
}
var rightStreetLight = rightRoadProps.FirstOrDefault(p => p.m_prop.name.ToLower().Contains("new street light"));
if (rightStreetLight != null)
{
rightStreetLight.m_finalProp =
rightStreetLight.m_prop = Prefabs.Find<PropInfo>(MediumAvenueSideLightBuilder.NAME);
}
}
if (version == NetInfoVersion.Slope)
{
leftRoadProps.AddLeftWallLights(info.m_pavementWidth);
rightRoadProps.AddRightWallLights(info.m_pavementWidth);
}
//.........这里部分代码省略.........
示例3: BuildUp
public void BuildUp(NetInfo info, NetInfoVersion version)
{
///////////////////////////
// Template //
///////////////////////////
var owRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_2L);
var owRoadTunnelInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ONEWAY_2L_TUNNEL);
///////////////////////////
// 3DModeling //
///////////////////////////
info.Setup16m2mSWMesh(version);
///////////////////////////
// Texturing //
///////////////////////////
SetupTextures(info, version);
///////////////////////////
// Set up //
///////////////////////////
info.m_hasParkingSpaces = false;
info.m_pavementWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 2 : 5);
info.m_halfWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 8 : 11);
if (version == NetInfoVersion.Tunnel)
{
info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground;
info.m_setCitizenFlags = CitizenInstance.Flags.Transition | CitizenInstance.Flags.Underground;
info.m_class = owRoadTunnelInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL4L_ROAD_TUNNEL);
}
else
{
info.m_class = owRoadInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL4L_ROAD);
}
// Setting up lanes
info.SetRoadLanes(version, new LanesConfiguration
{
IsTwoWay = true,
LanesToAdd = 2,
PedPropOffsetX = 0.5f,
BusStopOffset = 0f,
SpeedLimit = 1.0f
});
var leftPedLane = info.GetLeftRoadShoulder();
var rightPedLane = info.GetRightRoadShoulder();
// Fix for T++ legacy support
var lanes = info.m_lanes.OrderBy(l => l.m_position).ToArray();
var lanesLegacyOrder = new[]
{
lanes[0],
lanes[5],
lanes[1],
lanes[4],
lanes[2],
lanes[3]
};
info.m_lanes = lanesLegacyOrder;
//Setting Up Props
var leftRoadProps = leftPedLane.m_laneProps.m_props.ToList();
var rightRoadProps = rightPedLane.m_laneProps.m_props.ToList();
if (version == NetInfoVersion.Slope)
{
leftRoadProps.AddLeftWallLights(info.m_pavementWidth);
rightRoadProps.AddRightWallLights(info.m_pavementWidth);
}
leftPedLane.m_laneProps.m_props = leftRoadProps.ToArray();
rightPedLane.m_laneProps.m_props = rightRoadProps.ToArray();
info.TrimAboveGroundProps(version);
info.SetupNewSpeedLimitProps(50, 40);
// AI
var owPlayerNetAI = owRoadInfo.GetComponent<PlayerNetAI>();
var playerNetAI = info.GetComponent<PlayerNetAI>();
if (owPlayerNetAI != null && playerNetAI != null)
{
playerNetAI.m_constructionCost = owPlayerNetAI.m_constructionCost * 2; // Charge by the lane?
playerNetAI.m_maintenanceCost = owPlayerNetAI.m_maintenanceCost * 2; // Charge by the lane?
}
// TODO: make it configurable
var roadBaseAI = info.GetComponent<RoadBaseAI>();
if (roadBaseAI != null)
{
roadBaseAI.m_trafficLights = false;
}
}
示例4: 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;
}
}
示例5: BuildUp
public void BuildUp(NetInfo info, NetInfoVersion version)
{
///////////////////////////
// Template //
///////////////////////////
var roadTunnelInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_4L_TUNNEL);
var roadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_6L);
///////////////////////////
// 3DModeling //
///////////////////////////
info.Setup32m3mSW2mMdnMesh(version);
///////////////////////////
// Texturing //
///////////////////////////
SetupTextures(info, version);
///////////////////////////
// Set up //
///////////////////////////
info.m_hasParkingSpaces = false;
info.m_pavementWidth = (version == NetInfoVersion.Slope || version == NetInfoVersion.Tunnel ? 4 : 3);
info.m_halfWidth = (version == NetInfoVersion.Tunnel ? 17 : 16);
if (version == NetInfoVersion.Tunnel)
{
info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground;
info.m_setCitizenFlags = CitizenInstance.Flags.Transition | CitizenInstance.Flags.Underground;
info.m_class = roadTunnelInfo.m_class.Clone(NetInfoClasses.NEXT_XLARGE_ROAD_TUNNEL);
}
else
{
info.m_class = roadInfo.m_class.Clone(NetInfoClasses.NEXT_XLARGE_ROAD);
}
// Setting up lanes
info.SetRoadLanes(version, new LanesConfiguration
{
IsTwoWay = true,
LanesToAdd = 4,
LaneWidth = version == NetInfoVersion.Slope ? 2.75f : 3,
PedPropOffsetX = version == NetInfoVersion.Slope ? 1.5f : 1f,
CenterLane = CenterLaneType.Median,
CenterLaneWidth = 2,
BusStopOffset = 0f
});
var medianLane = info.GetMedianLane();
var leftPedLane = info.GetLeftRoadShoulder();
var rightPedLane = info.GetRightRoadShoulder();
// Fix for T++ legacy support (reordering)
if (medianLane != null)
{
info.m_lanes = info
.m_lanes
.Except(medianLane)
.Union(medianLane)
.ToArray();
}
//Setting Up Props
var leftPedLaneProps = leftPedLane.m_laneProps.m_props.ToList();
var rightPedLaneProps = rightPedLane.m_laneProps.m_props.ToList();
var medianPedLaneProps = medianLane?.m_laneProps?.m_props.ToList();
if (version != NetInfoVersion.Tunnel)
{
var medianStreetLight = medianPedLaneProps?.FirstOrDefault(p => p.m_prop.name.ToLower().Contains("avenue light"));
if (medianStreetLight != null)
{
medianStreetLight.m_finalProp =
medianStreetLight.m_prop = Prefabs.Find<PropInfo>(LargeAvenueMedianLightBuilder.NAME);
}
}
if (medianPedLaneProps != null)
{
medianPedLaneProps.RemoveProps("50 Speed Limit");
}
if (version == NetInfoVersion.Slope)
{
leftPedLaneProps.AddLeftWallLights(info.m_pavementWidth);
rightPedLaneProps.AddRightWallLights(info.m_pavementWidth);
}
leftPedLane.m_laneProps.m_props = leftPedLaneProps.ToArray();
rightPedLane.m_laneProps.m_props = rightPedLaneProps.ToArray();
if (medianLane?.m_laneProps != null && medianPedLaneProps != null)
{
medianLane.m_laneProps.m_props = medianPedLaneProps.ToArray();
}
info.TrimAboveGroundProps(version);
// AI
var owPlayerNetAI = roadInfo.GetComponent<PlayerNetAI>();
var playerNetAI = info.GetComponent<PlayerNetAI>();
//.........这里部分代码省略.........
示例6: BuildUp
public void BuildUp(NetInfo info, NetInfoVersion version)
{
///////////////////////////
// Template //
///////////////////////////
var roadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_2L);
///////////////////////////
// 3DModeling //
///////////////////////////
info.Setup8m1p5mSWMesh(version);
///////////////////////////
// Texturing //
///////////////////////////
switch (version)
{
case NetInfoVersion.Ground:
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\TinyRoads\Alley2L\Textures\Ground_Segment__MainTex.png",
@"Roads\TinyRoads\Alley2L\Textures\Ground_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\TinyRoads\Alley2L\Textures\Ground_Segment_LOD__MainTex.png",
@"Roads\TinyRoads\Alley2L\Textures\Ground_Segment_LOD__APRMap.png",
@"Roads\TinyRoads\Alley2L\Textures\Ground_LOD__XYSMap.png"));
foreach (var node in info.m_nodes)
{
if (node.m_flagsForbidden == NetNode.Flags.Transition)
{
node.SetTextures(
new TextureSet
(@"Roads\TinyRoads\Alley2L\Textures\Ground_Node__MainTex.png",
@"Roads\TinyRoads\Alley2L\Textures\Ground_Node__APRMap.png"),
new LODTextureSet
(@"Roads\TinyRoads\Alley2L\Textures\Ground_Node_LOD__MainTex.png",
@"Roads\TinyRoads\Alley2L\Textures\Ground_Node_LOD__APRMap.png",
@"Roads\TinyRoads\Alley2L\Textures\Ground_LOD__XYSMap.png"));
}
else if (node.m_flagsRequired == NetNode.Flags.Transition)
{
node.SetTextures(
new TextureSet
(@"Roads\TinyRoads\Alley2L\Textures\Ground_Trans__MainTex.png",
@"Roads\TinyRoads\Alley2L\Textures\Ground_Trans__APRMap.png"),
new LODTextureSet
(@"Roads\TinyRoads\Alley2L\Textures\Ground_Trans_LOD__MainTex.png",
@"Roads\TinyRoads\Alley2L\Textures\Ground_Trans_LOD__APRMap.png",
@"Roads\TinyRoads\Alley2L\Textures\Ground_LOD__XYSMap.png"));
}
}
break;
}
///////////////////////////
// Set up //
///////////////////////////
info.m_hasParkingSpaces = false;
info.m_halfWidth = 4f;
info.m_pavementWidth = 1.5f;
info.m_surfaceLevel = 0;
info.m_class = roadInfo.m_class.Clone("NExt2LAlley");
info.m_class.m_level = (ItemClass.Level)5; //New level
info.m_lanes = info.m_lanes
.Where(l => l.m_laneType != NetInfo.LaneType.Parking)
.ToArray();
var pedLanes = info.m_lanes.Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian);
var roadLanes = info.m_lanes.Where(l => l.m_laneType != NetInfo.LaneType.Pedestrian && l.m_laneType != NetInfo.LaneType.None);
foreach (var pedLane in pedLanes)
{
pedLane.m_verticalOffset = 0.25f;
}
foreach (var roadLane in roadLanes)
{
roadLane.m_verticalOffset = 0.1f;
}
info.SetRoadLanes(version, new LanesConfiguration
{
IsTwoWay = true,
LaneWidth = 2.5f,
SpeedLimit = 0.6f,
BusStopOffset = 0f,
PedLaneOffset = -0.75f,
PedPropOffsetX = 2.25f
});
info.SetupNewSpeedLimitProps(30, 40);
info.TrimArrowsProps();
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;
//.........这里部分代码省略.........