本文整理汇总了C#中NetInfo.SetAllSegmentsTexture方法的典型用法代码示例。如果您正苦于以下问题:C# NetInfo.SetAllSegmentsTexture方法的具体用法?C# NetInfo.SetAllSegmentsTexture怎么用?C# NetInfo.SetAllSegmentsTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetInfo
的用法示例。
在下文中一共展示了NetInfo.SetAllSegmentsTexture方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupTextures
private static void SetupTextures(NetInfo info, NetInfoVersion version)
{
switch (version)
{
case NetInfoVersion.Ground:
info.SetAllSegmentsTexture(
new TextureSet
(null,
@"Roads\Common\Textures\Plain\Ground_Segment__AlphaMap.png"),
new LODTextureSet
(@"Roads\Common\Textures\Plain\Ground_Segment_LOD__MainTex.png",
@"Roads\Common\Textures\Plain\Ground_Segment_LOD__AlphaMap.png",
@"Roads\Common\Textures\Plain\Ground_Segment_LOD__XYSMap.png"));
foreach (var node in info.m_nodes)
{
if (node.m_flagsRequired == NetNode.Flags.Transition)
{
node.SetTextures(
new TextureSet
(null,
@"Roads\Common\Textures\Plain\Ground_Trans__AlphaMap.png"),
new LODTextureSet
(@"Roads\Common\Textures\Plain\Ground_Trans_LOD__MainTex.png",
@"Roads\Common\Textures\Plain\Ground_Trans_LOD__AlphaMap.png",
@"Roads\Common\Textures\Plain\Ground_Trans_LOD__XYSMap.png"));
}
else
{
node.SetTextures(
new TextureSet
(null,
@"Roads\Common\Textures\Plain\Ground_Segment__AlphaMap.png"),
new LODTextureSet
(@"Roads\Common\Textures\Plain\Ground_Node_LOD__MainTex.png",
@"Roads\Common\Textures\Plain\Ground_Node_LOD__AlphaMap.png",
@"Roads\Common\Textures\Plain\Ground_Node_LOD__XYSMap.png"));
}
}
break;
}
}
示例2: BuildUp
public void BuildUp(NetInfo info, NetInfoVersion version)
{
///////////////////////////
// Template //
///////////////////////////
var owRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ONEWAY_2L);
///////////////////////////
// 3DModeling //
///////////////////////////
if (version == NetInfoVersion.Ground)
{
var segments0 = info.m_segments[0];
var nodes0 = info.m_nodes[0];
segments0.m_forwardRequired = NetSegment.Flags.None;
segments0.m_forwardForbidden = NetSegment.Flags.None;
segments0.m_backwardRequired = NetSegment.Flags.None;
segments0.m_backwardForbidden = NetSegment.Flags.None;
segments0.SetMeshes
(@"NewNetwork\SmallHeavyRoads\Meshes\Ground.obj",
@"NewNetwork\SmallHeavyRoads\Meshes\Ground_LOD.obj");
nodes0.SetMeshes
(@"NewNetwork\SmallHeavyRoads\Meshes\Ground.obj",
@"NewNetwork\SmallHeavyRoads\Meshes\Ground_Node_LOD.obj");
info.m_segments = new[] { segments0 };
info.m_nodes = new[] { nodes0 };
}
///////////////////////////
// Texturing //
///////////////////////////
switch (version)
{
case NetInfoVersion.Ground:
info.SetAllSegmentsTexture(
new TexturesSet
(@"NewNetwork\OneWay3L\Textures\Ground_Segment__MainTex.png",
@"NewNetwork\OneWay3L\Textures\Ground_Segment__AlphaMap.png"),
new TexturesSet
(@"NewNetwork\OneWay3L\Textures\Ground_SegmentLOD__MainTex.png",
@"NewNetwork\OneWay3L\Textures\Ground_SegmentLOD__AlphaMap.png",
@"NewNetwork\OneWay3L\Textures\Ground_SegmentLOD__XYS.png"));
break;
}
///////////////////////////
// Set up //
///////////////////////////
info.m_hasParkingSpaces = false;
info.m_class = owRoadInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL3L_ROAD);
info.m_pavementWidth = 2;
info.m_class.m_level = ItemClass.Level.Level3; // To make sure they dont fit with the 4L Small Roads
// Setting up lanes
var vehicleLaneTypes = new[]
{
NetInfo.LaneType.Vehicle,
NetInfo.LaneType.PublicTransport,
NetInfo.LaneType.CargoVehicle,
NetInfo.LaneType.TransportVehicle
};
var templateLane = info.m_lanes
.Where(l =>
vehicleLaneTypes.Contains(l.m_laneType))
.OrderBy(l => l.m_position)
.First();
var vehicleLanes = new List<NetInfo.Lane>();
const float outerCarLanePosition = 4.0f;
const float pedLanePosition = 8f;
const float pedLaneWidth = 1.5f;
for (int i = 0; i < 3; i++)
{
var lane = templateLane.Clone(string.Format("Carlane {0}", i + 1));
lane.m_similarLaneIndex = i;
lane.m_similarLaneCount = 3;
switch (i)
{
case 0: lane.m_position = -outerCarLanePosition; break;
case 1: lane.m_position = 0f; break;
case 2: lane.m_position = outerCarLanePosition; break;
}
if (i == 2)
{
lane.m_allowStop = true;
lane.m_stopOffset = 0.7f;
}
vehicleLanes.Add(lane);
}
var pedestrianLanes = info.m_lanes
//.........这里部分代码省略.........
示例3: BuildUp
public void BuildUp(NetInfo info, NetInfoVersion version)
{
///////////////////////////
// Template //
///////////////////////////
var mediumRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.AVENUE_4L);
///////////////////////////
// Texturing //
///////////////////////////
switch (version)
{
case NetInfoVersion.Ground:
info.SetAllSegmentsTexture(
new TexturesSet
(@"Roads\MediumAvenue4L\Textures\Ground_Segment__MainTex.png",
@"Roads\MediumAvenue4L\Textures\Ground_Segment__AlphaMap.png"),
new TexturesSet
(@"Roads\MediumAvenue4L\Textures\Ground_SegmentLOD__MainTex.png",
@"Roads\MediumAvenue4L\Textures\Ground_SegmentLOD__AlphaMap.png",
@"Roads\MediumAvenue4L\Textures\Ground_SegmentLOD__XYSMap.png"));
info.SetAllNodesTexture(
new TexturesSet
(null,
@"Roads\MediumAvenue4L\Textures\Ground_Node__AlphaMap.png"));
break;
}
///////////////////////////
// Set up //
///////////////////////////
info.m_class = mediumRoadInfo.m_class.Clone(NetInfoClasses.NEXT_MEDIUM_ROAD);
info.m_UnlockMilestone = mediumRoadInfo.m_UnlockMilestone;
// Setting up lanes
var vehicleLaneTypes = new[]
{
NetInfo.LaneType.Vehicle,
NetInfo.LaneType.PublicTransport,
NetInfo.LaneType.CargoVehicle,
NetInfo.LaneType.TransportVehicle
};
var vehicleLanes = mediumRoadInfo
.m_lanes
.Where(l => vehicleLaneTypes.Contains(l.m_laneType))
.Select(l => l.ShallowClone())
.OrderBy(l => l.m_position)
.ToArray();
var nonVehicleLanes = info.m_lanes
.Where(l => !vehicleLaneTypes.Contains(l.m_laneType))
.ToArray();
info.m_lanes = vehicleLanes
.Union(nonVehicleLanes)
.ToArray();
for (var i = 0; i < vehicleLanes.Length; i++)
{
var lane = vehicleLanes[i];
switch (i)
{
// Inside lane
case 1:
case 2:
if (lane.m_position < 0)
{
lane.m_position += 0.5f;
}
else
{
lane.m_position += -0.5f;
}
break;
}
}
info.Setup50LimitProps();
if (version == NetInfoVersion.Ground)
{
var mrPlayerNetAI = mediumRoadInfo.GetComponent<PlayerNetAI>();
var playerNetAI = info.GetComponent<PlayerNetAI>();
if (mrPlayerNetAI != null && playerNetAI != null)
{
playerNetAI.m_constructionCost = mrPlayerNetAI.m_constructionCost * 9 / 10; // 10% decrease
playerNetAI.m_maintenanceCost = mrPlayerNetAI.m_maintenanceCost * 9 / 10; // 10% decrease
}
var mrRoadBaseAI = mediumRoadInfo.GetComponent<RoadBaseAI>();
var roadBaseAI = info.GetComponent<RoadBaseAI>();
if (mrRoadBaseAI != null && roadBaseAI != null)
{
//.........这里部分代码省略.........
示例4: SetupTextures
private static void SetupTextures(NetInfo info, NetInfoVersion version)
{
switch (version)
{
case NetInfoVersion.Ground:
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\Avenues\MediumAvenue4LTL\Textures\Ground_Segment__MainTex.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Ground_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\Avenues\MediumAvenue4LTL\Textures\Ground_SegmentLOD__MainTex.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Ground_SegmentLOD__APRMap.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Ground_SegmentLOD__XYSMap.png"));
break;
case NetInfoVersion.Elevated:
case NetInfoVersion.Bridge:
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_Segment__MainTex.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_SegmentLOD__MainTex.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_SegmentLOD__APRMap.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_SegmentLOD__XYSMap.png"));
break;
//info.SetAllNodesTexture(
// new TextureSet
// (@"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_Segment__MainTex.png",
// @"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_Node__APRMap.png"),
// new LODTextureSet
// (@"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_SegmentLOD__MainTex.png",
// @"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_NodeLOD__APRMap.png",
// @"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_SegmentLOD__XYSMap.png"));
case NetInfoVersion.Slope:
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\Avenues\MediumAvenue4LTL\Textures\Slope_Segment__MainTex.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Slope_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\Avenues\MediumAvenue4LTL\Textures\Slope_SegmentLOD__MainTex.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Slope_SegmentLOD__APRMap.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Slope_SegmentLOD__XYSMap.png"));
foreach(var node in info.m_nodes)
{
if (node.m_mesh.name == "Slope_U_Node")
{
node.SetTextures(
new TextureSet
(@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_Segment__MainTex.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_Node__APRMap.png"),
new LODTextureSet
(@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__MainTex.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__APRMap.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__XYSMap.png"));
}
}
//info.SetAllNodesTexture(
//new TextureSet
// (@"Roads\Highways\Highway4L\Textures\Slope_Node__MainTex.png",
// @"Roads\Highways\Highway4L\Textures\Ground_Node__APRMap.png"),
//new LODTextureSet
// (@"Roads\Highways\Highway4L\Textures\Ground_NodeLOD__MainTex.png",
// @"Roads\Highways\Highway4L\Textures\Ground_NodeLOD__APRMap.png",
// @"Roads\Highways\Highway4L\Textures\Ground_LOD__XYSMap.png"));
break;
case NetInfoVersion.Tunnel:
{
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_Segment__MainTex.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__MainTex.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__APRMap.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__XYSMap.png"));
info.SetAllNodesTexture(
new TextureSet
(@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_Segment__MainTex.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_Node__APRMap.png"),
new LODTextureSet
(@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__MainTex.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__APRMap.png",
@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__XYSMap.png"));
break;
}
}
}
示例5: SetupTextures
private static void SetupTextures(NetInfo info, NetInfoVersion version)
{
var aprPathPrefix = (RoadColorChanger.IsPluginActive ? RoadColorChanger.GetTexturePrefix() : string.Empty);
switch (version)
{
case NetInfoVersion.Ground:
info.SetAllSegmentsTexture(
new TextureSet(
@"Roads\Highways\Highway6L\Textures\Ground_Segment__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Ground_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\Highways\Highway6L\Textures\Ground_SegmentLOD__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Ground_SegmentLOD__APRMap.png",
@"Roads\Highways\Highway6L\Textures\Ground_SegmentLOD__XYSMap.png"));
info.SetAllNodesTexture(
new TextureSet
(@"Roads\Highways\Highway6L\Textures\Ground_Node__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Ground_Node__APRMap.png"),
new LODTextureSet
(@"Roads\Highways\Highway6L\Textures\Ground_NodeLOD__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Ground_NodeLOD__APRMap.png",
@"Roads\Highways\Highway6L\Textures\Ground_NodeLOD__XYSMap.png"));
break;
case NetInfoVersion.Elevated:
case NetInfoVersion.Bridge:
info.SetAllSegmentsTexture(
new TextureSet(
@"Roads\Highways\Highway6L\Textures\Elevated_Segment__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Elevated_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\Highways\Highway6L\Textures\Elevated_SegmentLOD__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Elevated_SegmentLOD__APRMap.png",
@"Roads\Highways\Highway6L\Textures\Elevated_LOD__XYSMap.png"));
info.SetAllNodesTexture(
new TextureSet
(@"Roads\Highways\Highway6L\Textures\Elevated_Node__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Elevated_Node__APRMap.png"),
new LODTextureSet
(@"Roads\Highways\Highway6L\Textures\Elevated_NodeLOD__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Elevated_NodeLOD__APRMap.png",
@"Roads\Highways\Highway6L\Textures\Elevated_LOD__XYSMap.png"));
break;
case NetInfoVersion.Slope:
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\Highways\Highway6L\Textures\Slope_Segment__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Slope_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\Highways\Highway6L\Textures\Slope_SegmentLOD__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Slope_SegmentLOD__APRMap.png",
@"Roads\Highways\Highway6L\Textures\Slope_SegmentLOD__XYSMap.png"));
info.SetAllNodesTexture(
new TextureSet
(@"Roads\Highways\Highway6L\Textures\Tunnel_Node__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Ground_Node__APRMap.png"),
new LODTextureSet
(@"Roads\Highways\Highway6L\Textures\Ground_NodeLOD__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Ground_NodeLOD__APRMap.png",
@"Roads\Highways\Highway6L\Textures\Ground_NodeLOD__XYSMap.png"));
break;
case NetInfoVersion.Tunnel:
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\Highways\Highway6L\Textures\Tunnel_Segment__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Tunnel_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\Highways\Highway6L\Textures\Tunnel_SegmentLOD__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Tunnel_SegmentLOD__APRMap.png",
@"Roads\Highways\Highway6L\Textures\Tunnel_NodeLOD__XYSMap.png"));
info.SetAllNodesTexture(
new TextureSet
(@"Roads\Highways\Highway6L\Textures\Tunnel_Node__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Tunnel_" + (RoadColorChanger.IsPluginActive ? "Node" : "Segment") + "__APRMap.png"),
new LODTextureSet
(@"Roads\Highways\Highway6L\Textures\Tunnel_NodeLOD__MainTex.png",
aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Tunnel_SegmentLOD__APRMap.png",
@"Roads\Highways\Highway6L\Textures\Tunnel_NodeLOD__XYSMap.png"));
break;
}
}
示例6: BuildUp
public void BuildUp(NetInfo info, NetInfoVersion version)
{
///////////////////////////
// Template //
///////////////////////////
var highwayInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.HIGHWAY_3L);
///////////////////////////
// 3DModeling //
///////////////////////////
if (version == NetInfoVersion.Ground)
{
info.m_surfaceLevel = 0;
info.m_class = highwayInfo.m_class.Clone(NetInfoClasses.NEXT_HIGHWAY);
var segments0 = info.m_segments[0];
var nodes0 = info.m_nodes[0];
segments0.m_backwardForbidden = NetSegment.Flags.None;
segments0.m_backwardRequired = NetSegment.Flags.None;
segments0.m_forwardForbidden = NetSegment.Flags.None;
segments0.m_forwardRequired = NetSegment.Flags.None;
var nodes1 = nodes0.ShallowClone();
nodes0.m_flagsForbidden = NetNode.Flags.Transition;
nodes0.m_flagsRequired = NetNode.Flags.None;
nodes1.m_flagsForbidden = NetNode.Flags.None;
nodes1.m_flagsRequired = NetNode.Flags.Transition;
segments0.SetMeshes
(@"Roads\Highway2L\Meshes\Ground.obj",
@"Roads\Highway2L\Meshes\Ground_LOD.obj");
nodes0.SetMeshes
(@"Roads\Highway2L\Meshes\Ground.obj",
@"Roads\Highway2L\Meshes\Ground_Node_LOD.obj");
nodes1.SetMeshes
(@"Roads\Highway2L\Meshes\Ground_Trans.obj",
@"Roads\Highway2L\Meshes\Ground_Trans_LOD.obj");
info.m_segments = new[] { segments0 };
info.m_nodes = new[] { nodes0, nodes1 };
}
///////////////////////////
// Texturing //
///////////////////////////
switch (version)
{
case NetInfoVersion.Ground:
info.SetAllSegmentsTexture(
new TexturesSet
(@"Roads\Highway1L\Textures\Ground_Segment__MainTex.png",
@"Roads\Highway1L\Textures\Ground_Segment__AlphaMap.png"),
new TexturesSet
(@"Roads\Highway1L\Textures\Ground_SegmentLOD__MainTex.png",
@"Roads\Highway1L\Textures\Ground_SegmentLOD__AlphaMap.png",
@"Roads\Highway1L\Textures\Ground_SegmentLOD__XYSMap.png"));
info.SetAllNodesTexture(
new TexturesSet
(@"Roads\Highway1L\Textures\Ground_Node__MainTex.png",
@"Roads\Highway1L\Textures\Ground_Node__AlphaMap.png"),
new TexturesSet
(@"Roads\Highway1L\Textures\Ground_NodeLOD__MainTex.png",
@"Roads\Highway1L\Textures\Ground_NodeLOD__AlphaMap.png",
@"Roads\Highway1L\Textures\Ground_NodeLOD__XYSMap.png"));
break;
case NetInfoVersion.Elevated:
case NetInfoVersion.Bridge:
info.SetAllNodesTexture(
new TexturesSet
(@"Roads\Highway2L\Textures\Elevated_Node__MainTex.png",
@"Roads\Highway2L\Textures\Elevated_Node__AlphaMap.png"));
// Lets leave the crossings there until we have a fix
//new TexturesSet
// (@"Roads\Highway2L\Textures\Elevated_NodeLOD__MainTex.png",
// @"Roads\Highway2L\Textures\Elevated_NodeLOD__AlphaMap.png",
// @"Roads\Highway2L\Textures\Elevated_NodeLOD__XYSMap.png"));
break;
case NetInfoVersion.Slope:
info.SetAllNodesTexture(
new TexturesSet
(@"Roads\Highway2L\Textures\Slope_Node__MainTex.png",
@"Roads\Highway2L\Textures\Slope_Node__AlphaMap.png"),
new TexturesSet
(@"Roads\Highway2L\Textures\Slope_NodeLOD__MainTex.png",
@"Roads\Highway2L\Textures\Slope_NodeLOD__AlphaMap.png",
@"Roads\Highway2L\Textures\Slope_NodeLOD__XYSMap.png"));
break;
case NetInfoVersion.Tunnel:
break;
//.........这里部分代码省略.........
示例7: BuildUp
public void BuildUp(NetInfo info, NetInfoVersion version)
{
///////////////////////////
// Texturing //
///////////////////////////
switch (version)
{
case NetInfoVersion.Ground:
info.SetAllSegmentsTexture(
new TexturesSet
(@"NewNetwork\OneWayMedium4L\Textures\Ground_Segment__MainTex.png",
@"NewNetwork\OneWayMedium4L\Textures\Ground_Segment__AlphaMap.png"));
info.SetAllNodesTexture(
new TexturesSet
(@"NewNetwork\OneWayMedium4L\Textures\Ground_Node__MainTex.png",
@"NewNetwork\OneWayMedium4L\Textures\Ground_Node__AlphaMap.png"));
break;
}
///////////////////////////
// 3DModeling //
///////////////////////////
if (version == NetInfoVersion.Ground)
{
var segments0 = info.m_segments[0];
var nodes0 = info.m_nodes[0];
segments0.SetMeshes
(@"NewNetwork\OneWayMedium4L\Meshes\Ground.obj",
@"NewNetwork\OneWayMedium4L\Meshes\Ground_LOD.obj");
nodes0.SetMeshes
(@"NewNetwork\OneWayMedium4L\Meshes\Ground.obj",
@"NewNetwork\OneWayMedium4L\Meshes\Ground_Node_LOD.obj");
info.m_segments = new[] { segments0 };
info.m_nodes = new[] { nodes0};
}
///////////////////////////
// Set up //
///////////////////////////
var vehicleLaneWidth = 3f;
var pedWidth = 4f;
var roadHalfWidth = 8f;
var parkingLaneWidth = 2f;
var vehicleLanesToTake = 4;
info.m_halfWidth = 12.0f;
info.m_pavementWidth = pedWidth;
// Disabling Parkings and Peds
//foreach (var l in info.m_lanes)
//{
// if (l.m_laneType == NetInfo.LaneType.Parking)
// {
// l.m_laneType = NetInfo.LaneType.None;
// }
//}
// Setting up lanes
var lanes = info.m_lanes;
var parkingLanes = lanes
.Where(l => l.m_laneType == NetInfo.LaneType.Parking)
.ToList();
var vehicleLanes = lanes
.Where(l => l.m_laneType != NetInfo.LaneType.None)
.Where(l => l.m_laneType != NetInfo.LaneType.Pedestrian)
.Where(l => l.m_laneType != NetInfo.LaneType.Parking)
.Take(vehicleLanesToTake).ToList();
var pedestrianLanes = lanes
.Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian)
.OrderBy(l => l.m_similarLaneIndex)
.ToList();
for (var i = 0; i < pedestrianLanes.Count; i++)
{
var multiplier = pedestrianLanes[i].m_position / Math.Abs(pedestrianLanes[i].m_position);
pedestrianLanes[i].m_width = pedWidth;
pedestrianLanes[i].m_position = multiplier * (roadHalfWidth + (.5f * pedWidth));
foreach (var prop in pedestrianLanes[i].m_laneProps.m_props)
{
prop.m_position.x += multiplier * 1.5f;
}
}
for (var i = 0; i < vehicleLanes.Count; i++)
{
vehicleLanes[i].m_similarLaneCount = vehicleLanes.Count();
vehicleLanes[i].m_similarLaneIndex = i;
vehicleLanes[i].m_width = vehicleLaneWidth;
vehicleLanes[i].m_position = (-1 * ((vehicleLanes.Count / 2f) - .5f) + i) * vehicleLaneWidth;
}
for (var i = 0; i < parkingLanes.Count; i++)
{
//.........这里部分代码省略.........
示例8: SetupTextures
private static void SetupTextures(NetInfo info, NetInfoVersion version)
{
switch (version)
{
case NetInfoVersion.Ground:
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Ground_Segment__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Ground_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Ground_Segment_LOD__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Ground_Segment_LOD__APRMap.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Ground_Segment_LOD__XYSMap.png"));
info.SetAllNodesTexture(
new TextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Ground_Node__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Ground_Node__APRMap.png"),
new LODTextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Ground_Node_LOD__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Ground_Node_LOD__APRMap.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Ground_Segment_LOD__XYSMap.png"));
break;
case NetInfoVersion.Elevated:
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Segment__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Segment_LOD__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Segment_LOD__APRMap.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Segment_LOD__XYSMap.png"));
info.SetAllNodesTexture(
new TextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Node__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Node__APRMap.png"),
new LODTextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Segment_LOD__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Node_LOD__APRMap.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Segment_LOD__XYSMap.png"));
break;
case NetInfoVersion.Bridge:
for (int i = 0; i < info.m_segments.Length; i++)
{
if (info.m_segments[i].m_mesh.name == "Bridge_Cables")
{
info.m_segments[i].SetTextures(
new TextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Bridge_Cables__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Bridge_Cables__APRMap.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Bridge_Cables__XYSMap.png"),
new LODTextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Bridge_Cables_LOD__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Bridge_Cables_LOD__APRMap.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Bridge_Cables_LOD__XYSMap.png"));
}
else
{
info.m_segments[i].SetTextures(
new TextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Segment__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Segment_LOD__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Segment_LOD__APRMap.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Segment_LOD__XYSMap.png"));
}
}
info.SetAllNodesTexture(
new TextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Node__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Node__APRMap.png"),
new LODTextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Segment_LOD__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Node_LOD__APRMap.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Elevated_Segment_LOD__XYSMap.png"));
break;
case NetInfoVersion.Slope:
for (int i = 0; i < info.m_segments.Length; i++)
{
if (info.m_segments[i].m_mesh.name == "medium-tunnel-slope")
{
info.m_segments[i].SetTextures(
new TextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Slope_Segment__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Slope_Segment_Cover__APRMap.png"),
new LODTextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Slope_Segment_LOD__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Slope_Segment_LOD__APRMap.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Slope_Segment_LOD__XYSMap.png"));
}
else
{
info.m_segments[i].SetTextures(
new TextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Slope_Segment__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Slope_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\Avenues\LargeAvenue8LM\Textures\Slope_Segment_LOD__MainTex.png",
@"Roads\Avenues\LargeAvenue8LM\Textures\Slope_Segment_LOD__APRMap.png",
//.........这里部分代码省略.........
示例9: 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;
}
}
示例10: SetupTextures
private static void SetupTextures(NetInfo info, NetInfoVersion version)
{
switch (version)
{
case NetInfoVersion.Ground:
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Ground_Segment__MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Ground_Segment__AlphaMap.png"),
new LODTextureSet
(@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Ground_SegmentLOD__MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Ground_SegmentLOD__AlphaMap.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Ground_SegmentLOD__XYS.png"));
break;
case NetInfoVersion.Elevated:
case NetInfoVersion.Bridge:
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Elevated_MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Elevated_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Elevated_LOD__MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Elevated_SegmentLOD__APRMap.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Elevated_LOD__XYSMap.png"));
info.SetAllNodesTexture(
new TextureSet
(@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Elevated_MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Elevated_Node__APRMap.png"),
new LODTextureSet
(@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Elevated_LOD__MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Elevated_NodeLOD__APRMap.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Elevated_LOD__XYSMap.png"));
break;
case NetInfoVersion.Slope:
for (int i = 0; i < info.m_segments.Length; i++)
{
if (info.m_segments[i].m_mesh.name == "Slope")
{
info.m_segments[i].SetTextures(
new TextureSet
(@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Ground_Segment__MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Ground_Segment__AlphaMap.png"),
new LODTextureSet
(@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Ground_SegmentLOD__MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Ground_SegmentLOD__AlphaMap.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Slope_SegmentLOD2__XYSMap.png"));
}
else
{
info.m_segments[i].SetTextures(
new TextureSet
(@"Roads\Highways\Highway4L\Textures\Slope_Segment__MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Slope_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Slope_SegmentLOD__MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Slope_SegmentLOD__APRMap.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Slope_SegmentLOD__XYSMap.png"));
}
}
for (int i = 0; i < info.m_nodes.Length; i++)
{
if (info.m_nodes[i].m_mesh.name == "Slope_Node")
{
info.m_nodes[i].SetTextures(
new TextureSet
(@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Ground_Segment__MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Ground_Node__AlphaMap.png"),
new LODTextureSet
(@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Ground_SegmentLOD__MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Ground_SegmentLOD__AlphaMap.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Ground_SegmentLOD__XYS.png"));
}
else
{
info.m_nodes[i].SetTextures(
new TextureSet
(@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Tunnel_Segment__MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Tunnel_Node__APRMap.png"),
new LODTextureSet
(@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Tunnel_NodeLOD__MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Tunnel_LOD__APRMap.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Tunnel_LOD__XYSMap.png"));
}
}
//info.SetAllNodesTexture(
//new TextureSet
// (@"Roads\Highways\Highway4L\Textures\Slope_Node__MainTex.png",
// @"Roads\Highways\Highway4L\Textures\Ground_Node__APRMap.png"),
//new LODTextureSet
// (@"Roads\Highways\Highway4L\Textures\Ground_NodeLOD__MainTex.png",
// @"Roads\Highways\Highway4L\Textures\Ground_NodeLOD__APRMap.png",
// @"Roads\Highways\Highway4L\Textures\Ground_LOD__XYSMap.png"));
break;
case NetInfoVersion.Tunnel:
{
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Tunnel_Segment__MainTex.png",
@"Roads\SmallHeavyRoads\SmallAvenue4L\Textures\Tunnel_Segment__APRMap.png"),
new LODTextureSet
//.........这里部分代码省略.........
示例11: BuildUp
public void BuildUp(NetInfo info, NetInfoVersion version)
{
///////////////////////////
// 3DModeling //
///////////////////////////
if (version == NetInfoVersion.Ground)
{
info.m_surfaceLevel = 0;
var segments0 = info.m_segments[0];
var nodes0 = info.m_nodes[0];
segments0.SetMeshes
(@"NewNetwork\Alley2L\Meshes\Ground.obj",
@"NewNetwork\Alley2L\Meshes\Ground_LOD.obj");
nodes0.SetMeshes
(@"NewNetwork\Alley2L\Meshes\Ground.obj",
@"NewNetwork\Alley2L\Meshes\Ground_Node_LOD.obj");
info.m_segments = new[] { segments0 };
info.m_nodes = new[] { nodes0 };
}
///////////////////////////
// Texturing //
///////////////////////////
switch (version)
{
case NetInfoVersion.Ground:
info.SetAllSegmentsTexture(
new TexturesSet
(@"NewNetwork\Alley2L\Textures\Ground_Segment__MainTex.png",
@"NewNetwork\Alley2L\Textures\Ground_Segment__AlphaMap.png"));
//info.SetNodesTexture(
// new TexturesSet
// (@"NewNetwork\Alley2L\Textures\Ground_Node__MainTex.png",
// @"NewNetwork\Alley2L\Textures\Ground_Node__AlphaMap.png"));
break;
}
///////////////////////////
// Set up //
///////////////////////////
info.m_hasParkingSpaces = false;
info.m_halfWidth = 4f;
info.m_pavementWidth = 2f;
var vehicleLanes = info.m_lanes
.Where(l => l.m_laneType != NetInfo.LaneType.None)
.Where(l => l.m_laneType != NetInfo.LaneType.Pedestrian)
.Where(l => l.m_laneType != NetInfo.LaneType.Parking)
.ToList();
var pedestrianLanes = info.m_lanes
.Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian)
.OrderBy(l => l.m_similarLaneIndex)
.ToList();
var parkingLanes = info.m_lanes
.Where(l => l.m_laneType == NetInfo.LaneType.Parking)
.ToList();
foreach (var parkingLane in parkingLanes)
{
parkingLane.m_laneType = NetInfo.LaneType.None;
}
var roadHalfWidth = 2f;
var pedWidth = 2f;
for (var i = 0; i < vehicleLanes.Count; i++)
{
var multiplier = vehicleLanes[i].m_position / Math.Abs(vehicleLanes[i].m_position);
vehicleLanes[i].m_width = roadHalfWidth;
vehicleLanes[i].m_position = multiplier * 0.5f * roadHalfWidth;
vehicleLanes[i].m_speedLimit = 0.5f;
foreach (var prop in vehicleLanes[i].m_laneProps.m_props)
{
prop.m_position.x = multiplier * 0.4f;
}
}
for (var i = 0; i < pedestrianLanes.Count; i++)
{
var multiplier = pedestrianLanes[i].m_position / Math.Abs(pedestrianLanes[i].m_position);
pedestrianLanes[i].m_width = pedWidth;
pedestrianLanes[i].m_position = multiplier * (roadHalfWidth + (.5f * pedWidth));
foreach (var prop in pedestrianLanes[i].m_laneProps.m_props)
{
prop.m_position.x += multiplier * roadHalfWidth;
}
}
var onewayRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_2L);
if (version == NetInfoVersion.Ground)
{
//.........这里部分代码省略.........
示例12: SetupTextures
private static void SetupTextures(NetInfo info, NetInfoVersion version)
{
switch (version)
{
case NetInfoVersion.Ground:
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\PedestrianRoads\Promenade\Textures\Ground_Segment__MainTex.png",
@"Roads\PedestrianRoads\Promenade\Textures\Ground_Segment__AlphaMap.png",
@"Roads\PedestrianRoads\Promenade\Textures\Ground_Segment__XYSMap.png"),
new LODTextureSet
(@"Roads\PedestrianRoads\Promenade\Textures\Ground_Segment_LOD__MainTex.png",
@"Roads\PedestrianRoads\Promenade\Textures\Ground_Segment_LOD__AlphaMap.png",
@"Roads\PedestrianRoads\Promenade\Textures\Ground_Segment_LOD__XYSMap.png"));
for (int i = 0; i < info.m_nodes.Length; i++)
{
if (info.m_nodes[i].m_flagsRequired == NetNode.Flags.Transition)
{
info.m_nodes[i].SetTextures(
new TextureSet
(@"Roads\PedestrianRoads\Promenade\Textures\Ground_Trans__MainTex.png",
@"Roads\PedestrianRoads\Promenade\Textures\Ground_Trans__AlphaMap.png",
@"Roads\PedestrianRoads\Promenade\Textures\Ground_Node__XYSMap.png"),
new LODTextureSet
(@"Roads\PedestrianRoads\Common\Textures\Ground_Trans_LOD__MainTex.png",
@"Roads\PedestrianRoads\Common\Textures\Ground_Trans_LOD__AlphaMap.png",
@"Roads\PedestrianRoads\Common\Textures\Ground_Node_LOD__XYSMap.png"));
}
else
{
info.m_nodes[i].SetTextures(
new TextureSet
(@"Roads\PedestrianRoads\Promenade\Textures\Ground_Node__MainTex.png",
@"Roads\PedestrianRoads\Promenade\Textures\Ground_Node__AlphaMap.png",
@"Roads\PedestrianRoads\Promenade\Textures\Ground_Node__XYSMap.png"),
new LODTextureSet
(@"Roads\PedestrianRoads\Promenade\Textures\Ground_Node_LOD__MainTex.png",
@"Roads\PedestrianRoads\Promenade\Textures\Ground_Node_LOD__AlphaMap.png",
@"Roads\PedestrianRoads\Common\Textures\Ground_Node_LOD__XYSMap.png"));
}
}
break;
case NetInfoVersion.Elevated:
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\PedestrianRoads\Promenade\Textures\Elevated_Segment__MainTex.png",
@"Roads\PedestrianRoads\Promenade\Textures\Elevated_Segment__AlphaMap.png",
@"Roads\PedestrianRoads\Promenade\Textures\Elevated_Segment__XYSMap.png"),
new LODTextureSet
(@"Roads\PedestrianRoads\Promenade\Textures\Elevated_Segment_LOD__MainTex.png",
@"Roads\PedestrianRoads\Promenade\Textures\Elevated_Segment_LOD__AlphaMap.png",
@"Roads\PedestrianRoads\Promenade\Textures\Elevated_Segment_LOD__XYSMap.png"));
for (int i = 0; i < info.m_nodes.Length; i++)
{
if (info.m_nodes[i].m_flagsRequired == NetNode.Flags.Transition)
{
info.m_nodes[i].SetTextures(
new TextureSet
(@"Roads\PedestrianRoads\Promenade\Textures\Elevated_Trans__MainTex.png",
@"Roads\PedestrianRoads\Promenade\Textures\Elevated_Trans__AlphaMap.png"),
new LODTextureSet
(@"Roads\PedestrianRoads\Common\Textures\Elevated_Trans_LOD__MainTex.png",
@"Roads\PedestrianRoads\Common\Textures\Elevated_Trans_LOD__AlphaMap.png",
@"Roads\PedestrianRoads\Promenade\Textures\Elevated_Node_LOD__XYSMap.png"));
}
else
{
info.m_nodes[i].SetTextures(
new TextureSet
(@"Roads\PedestrianRoads\Promenade\Textures\Elevated_Node__MainTex.png",
@"Roads\PedestrianRoads\Promenade\Textures\Elevated_Node__AlphaMap.png",
@"Roads\PedestrianRoads\Promenade\Textures\Elevated_Segment__XYSMap.png"),
new LODTextureSet
(@"Roads\PedestrianRoads\Common\Textures\Elevated_Trans_LOD__MainTex.png",
@"Roads\PedestrianRoads\Promenade\Textures\Elevated_Node_LOD__AlphaMap.png",
@"Roads\PedestrianRoads\Promenade\Textures\Elevated_Node_LOD__XYSMap.png"));
}
}
break;
}
}
开发者ID:Katalyst6,项目名称:CSL.TransitAddonMod,代码行数:83,代码来源:ZonablePedestrianPromenadeBuilder.Texturing.cs
示例13: BuildUp
public void BuildUp(NetInfo info, NetInfoVersion version)
{
///////////////////////////
// Template //
///////////////////////////
var onewayRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ONEWAY_2L);
///////////////////////////
// 3DModeling //
///////////////////////////
if (version == NetInfoVersion.Ground)
{
var segments0 = info.m_segments[0];
var nodes0 = info.m_nodes[0];
segments0.SetMeshes
(@"NewNetwork\OneWay1L\Meshes\Ground.obj",
@"NewNetwork\OneWay1L\Meshes\Ground_LOD.obj");
nodes0.SetMeshes
(@"NewNetwork\OneWay1L\Meshes\Ground.obj",
@"NewNetwork\OneWay1L\Meshes\Ground_LOD.obj");
info.m_segments = new[] { segments0 };
info.m_nodes = new[] { nodes0 };
}
///////////////////////////
// Texturing //
///////////////////////////
switch (version)
{
case NetInfoVersion.Ground:
info.SetAllSegmentsTexture(
new TexturesSet
(@"NewNetwork\OneWay1L\Textures\Ground_Segment__MainTex.png",
@"NewNetwork\OneWay1L\Textures\Ground_Segment__AlphaMap.png"),
new TexturesSet
(@"NewNetwork\OneWay1L\Textures\Ground_SegmentLOD__MainTex.png",
@"NewNetwork\OneWay1L\Textures\Ground_SegmentLOD__AlphaMap.png",
@"NewNetwork\OneWay1L\Textures\Ground_SegmentLOD__XYSMap.png"));
info.SetAllNodesTexture(
new TexturesSet
(@"NewNetwork\OneWay1L\Textures\Ground_Node__MainTex.png",
@"NewNetwork\OneWay1L\Textures\Ground_Node__AlphaMap.png"),
new TexturesSet
(@"NewNetwork\OneWay1L\Textures\Ground_NodeLOD__MainTex.png",
@"NewNetwork\OneWay1L\Textures\Ground_NodeLOD__AlphaMap.png",
@"NewNetwork\OneWay1L\Textures\Ground_NodeLOD__XYSMap.png"));
break;
}
///////////////////////////
// Set up //
///////////////////////////
info.m_class = onewayRoadInfo.m_class.Clone("SmallOneway");
info.m_hasParkingSpaces = false;
info.m_halfWidth = 4f;
info.m_pavementWidth = 2f;
// Setting up lanes
var parkingLanes = info.m_lanes
.Where(l => l.m_laneType == NetInfo.LaneType.Parking)
.ToList();
foreach (var parkingLane in parkingLanes)
{
parkingLane.m_laneType = NetInfo.LaneType.None;
}
var vehicleLanes = info.m_lanes
.Where(l => l.m_laneType != NetInfo.LaneType.None)
.Where(l => l.m_laneType != NetInfo.LaneType.Pedestrian)
.Where(l => l.m_laneType != NetInfo.LaneType.Parking)
.ToList();
var pedestrianLanes = info.m_lanes
.Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian)
.OrderBy(l => l.m_similarLaneIndex)
.ToList();
var vehicleLane = vehicleLanes[0];
vehicleLanes[1].m_laneType = NetInfo.LaneType.None;
vehicleLane.m_width = 3f;
vehicleLane.m_verticalOffset = -0.3f;
vehicleLane.m_position = 0f;
vehicleLane.m_speedLimit *= 0.7f;
foreach (var prop in vehicleLane.m_laneProps.m_props)
{
prop.m_position.x = 0f;
}
var roadHalfWidth = 2f;
var pedWidth = 2f;
for (var i = 0; i < pedestrianLanes.Count; i++)
{
var multiplier = pedestrianLanes[i].m_position / Math.Abs(pedestrianLanes[i].m_position);
pedestrianLanes[i].m_width = pedWidth;
//.........这里部分代码省略.........
示例14: BuildUp
public void BuildUp(NetInfo info, NetInfoVersion version)
{
///////////////////////////
// Template //
///////////////////////////
var basicRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_2L);
///////////////////////////
// 3DModeling //
///////////////////////////
if (version == NetInfoVersion.Ground)
{
var segments0 = info.m_segments[0];
var nodes0 = info.m_nodes[0];
segments0.m_forwardRequired = NetSegment.Flags.None;
segments0.m_forwardForbidden = NetSegment.Flags.None;
segments0.m_backwardRequired = NetSegment.Flags.None;
segments0.m_backwardForbidden = NetSegment.Flags.None;
segments0.SetMeshes
(@"NewNetwork\SmallHeavyRoads\Meshes\Ground.obj",
@"NewNetwork\SmallHeavyRoads\Meshes\Ground_LOD.obj");
nodes0.SetMeshes
(@"NewNetwork\SmallHeavyRoads\Meshes\Ground.obj",
@"NewNetwork\SmallHeavyRoads\Meshes\Ground_Node_LOD.obj");
info.m_segments = new[] { segments0 };
info.m_nodes = new[] { nodes0 };
}
///////////////////////////
// Texturing //
///////////////////////////
switch (version)
{
case NetInfoVersion.Ground:
info.SetAllSegmentsTexture(
new TexturesSet
(@"NewNetwork\SmallAvenue4L\Textures\Ground_Segment__MainTex.png",
@"NewNetwork\SmallAvenue4L\Textures\Ground_Segment__AlphaMap.png"),
new TexturesSet
(@"NewNetwork\SmallAvenue4L\Textures\Ground_SegmentLOD__MainTex.png",
@"NewNetwork\SmallAvenue4L\Textures\Ground_SegmentLOD__AlphaMap.png",
@"NewNetwork\SmallAvenue4L\Textures\Ground_SegmentLOD__XYS.png"));
break;
}
///////////////////////////
// Set up //
///////////////////////////
info.m_hasParkingSpaces = false;
info.m_class = basicRoadInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL4L_ROAD);
info.m_pavementWidth = 2;
// Setting up lanes
var vehicleLaneTypes = new[]
{
NetInfo.LaneType.Vehicle,
NetInfo.LaneType.PublicTransport,
NetInfo.LaneType.CargoVehicle,
NetInfo.LaneType.TransportVehicle
};
var vehicleLanes = info.m_lanes
.Where(l =>
l.m_laneType.HasFlag(NetInfo.LaneType.Parking) ||
vehicleLaneTypes.Contains(l.m_laneType))
.OrderBy(l => l.m_position)
.ToArray();
const float outerCarLanePosition = 4.4f;
const float innerCarLanePosition = 1.5f;
const float pedLanePosition = 8f;
const float pedLaneWidth = 1.5f;
for (int i = 0; i < vehicleLanes.Length; i++)
{
var lane = vehicleLanes[i];
if (lane.m_laneType.HasFlag(NetInfo.LaneType.Parking))
{
int closestVehicleLaneId;
if (i - 1 >= 0 && vehicleLaneTypes.Contains(vehicleLanes[i - 1].m_laneType))
{
closestVehicleLaneId = i - 1;
}
else if (i + 1 < vehicleLanes.Length && vehicleLaneTypes.Contains(vehicleLanes[i + 1].m_laneType))
{
closestVehicleLaneId = i + 1;
}
else
{
continue; // Not supposed to happen
}
var closestVehicleLane = vehicleLanes[closestVehicleLaneId];
//.........这里部分代码省略.........
示例15: SetupTextures
//.........这里部分代码省略.........
new LODTextureSet
(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Elevated_LOD__MainTex.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Elevated_NodeLOD__APRMap.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Elevated_LOD__XYSMap.png"));
break;
case NetInfoVersion.Slope:
foreach (var segment in info.m_segments)
{
if (segment.m_mesh.name == "Slope")
{
var inverted = "_Inverted";
segment.SetTextures(
new TextureSet(
string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Ground_Segment{0}__MainTex.png", inverted),
string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Ground_Segment{0}__AlphaMap.png", inverted)),
new LODTextureSet(
string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Ground_SegmentLOD{0}__MainTex.png", inverted),
string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Ground_SegmentLOD{0}__AlphaMap.png", inverted),
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Slope_SegmentLOD2__XYSMap.png"));
}
else
{
segment.SetTextures(
new TextureSet
(@"Roads\Highways\Highway4L\Textures\Slope_Segment__MainTex.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Slope_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Slope_SegmentLOD__MainTex.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Slope_SegmentLOD__APRMap.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Slope_SegmentLOD__XYSMap.png"));
}
}
foreach (NetInfo.Node node in info.m_nodes)
{
if (node.m_mesh.name == "Slope_Node")
{
node.SetTextures(
new TextureSet
(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Ground_Segment__MainTex.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Ground_Node__AlphaMap.png"),
new LODTextureSet
(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Ground_SegmentLOD__MainTex.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Ground_SegmentLOD__AlphaMap.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Ground_SegmentLOD__XYS.png"));
}
else
{
node.SetTextures(
new TextureSet
(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_Segment__MainTex.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_Node__APRMap.png"),
new LODTextureSet
(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_NodeLOD__MainTex.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_LOD__APRMap.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_LOD__XYSMap.png"));
}
}
break;
case NetInfoVersion.Tunnel:
{
foreach (var segment in info.m_segments)
{
if (segment.m_mesh.name == "Tunnel")
{
var inverted = "_Inverted";
segment.SetTextures(
new TextureSet
(string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_Segment{0}__MainTex.png", inverted),
string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_Segment{0}__APRMap.png", inverted)),
new LODTextureSet
(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_NodeLOD__MainTex.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_LOD__APRMap.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_LOD__XYSMap.png"));
}
else
{
info.SetAllSegmentsTexture(
new TextureSet
(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_Segment__MainTex.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_Segment__APRMap.png"),
new LODTextureSet
(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_NodeLOD__MainTex.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_LOD__APRMap.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_LOD__XYSMap.png"));
}
}
info.SetAllNodesTexture(
new TextureSet
(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_Segment__MainTex.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_Node__APRMap.png"),
new LODTextureSet
(@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_NodeLOD__MainTex.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_LOD__APRMap.png",
@"Roads\SmallHeavyRoads\AsymRoadL1R2\Textures\Tunnel_LOD__XYSMap.png"));
break;
}
}
}