public static int GetInfoPrioirty(NetInfo info, NetInfo baseInfo = null) { PedestrianPathAI baseAI = baseInfo?.m_netAI as PedestrianPathAI; Assertion.AssertNotNull(baseAI, "baseAI"); if (info == baseAI.m_info) { return(0); } if (info == baseAI.m_elevatedInfo) { return(1); } if (info == baseAI.m_slopeInfo) { return(1); } if (info == baseAI.m_tunnelInfo) { return(2); } if (info == baseAI.m_bridgeInfo) { return(2); } Log.Error("Unreacahble code"); return(-1); }
public static void LinkSidewalkPillar(string prefabName, string pillar) { NetInfo pathInfo = PrefabCollection <NetInfo> .FindLoaded(prefabName); if (pathInfo == null) { return; } PedestrianPathAI pathAI = pathInfo.m_netAI as PedestrianPathAI; PedestrianBridgeAI pathElvAI = pathAI.m_elevatedInfo.m_netAI as PedestrianBridgeAI; PedestrianBridgeAI pathBridgeAI = pathAI.m_bridgeInfo.m_netAI as PedestrianBridgeAI; pathElvAI.m_bridgePillarInfo = PrefabCollection <BuildingInfo> .FindLoaded(pillar); pathBridgeAI.m_bridgePillarInfo = PrefabCollection <BuildingInfo> .FindLoaded(pillar); }
/* We change the road mode according to Fine Road Tool */ private static NetInfo FineRoadToolSelection(NetInfo prefab) { RoadAI roadAI = prefab.m_netAI as RoadAI; if (roadAI != null) { // If the user has manually selected underground/overground mode, we let it be if (!roadAI.IsUnderground() && !roadAI.IsOverground()) { switch (FineRoadTool.FineRoadTool.instance.mode) { case FineRoadTool.Mode.Ground: return(roadAI.m_info); case FineRoadTool.Mode.Elevated: case FineRoadTool.Mode.Bridge: if (roadAI.m_elevatedInfo != null) { return(roadAI.m_elevatedInfo); } break; case FineRoadTool.Mode.Tunnel: if (roadAI.m_tunnelInfo != null) { return(roadAI.m_tunnelInfo); } break; case FineRoadTool.Mode.Normal: case FineRoadTool.Mode.Single: break; } } } PedestrianPathAI pedestrianAI = prefab.m_netAI as PedestrianPathAI; if (pedestrianAI != null) { // If the user has manually selected underground/overground mode, we let it be if (!pedestrianAI.IsUnderground() && !pedestrianAI.IsOverground()) { switch (FineRoadTool.FineRoadTool.instance.mode) { case FineRoadTool.Mode.Ground: return(pedestrianAI.m_info); case FineRoadTool.Mode.Elevated: case FineRoadTool.Mode.Bridge: if (pedestrianAI.m_elevatedInfo != null) { return(pedestrianAI.m_elevatedInfo); } break; case FineRoadTool.Mode.Tunnel: if (pedestrianAI.m_tunnelInfo != null) { return(pedestrianAI.m_tunnelInfo); } break; case FineRoadTool.Mode.Normal: case FineRoadTool.Mode.Single: break; } } } return(prefab); }