private static bool zoningToggleAction(RoadAI ai, bool value)
 {
     if (!ZoningTogglesUI.defaultZoningSettings.ContainsKey((RoadBaseAI)ai))
     {
         string[] strArray = new string[14]
         {
             "Small Busway",
             "HighwayRamp",
             "Small Rural Highway",
             "Rural Highway",
             "Highway",
             "Four-Lane Highway",
             "Five-Lane Highway",
             "Large Highway",
             "Bundesstrasse",
             "Autobahn",
             "Planning Road (Small)",
             "Planning Road (Large)",
             "Small Highway",
             "Dike"
         };
         ZoningTogglesUI.defaultZoningSettings.Add((RoadBaseAI)ai, true);
         foreach (string str in strArray)
         {
             if (((Object)ai).get_name().StartsWith(str))
             {
                 ZoningTogglesUI.defaultZoningSettings[(RoadBaseAI)ai] = false;
             }
         }
     }
     ai.m_enableZoning = (__Null)(value ? 1 : 0);
     return(true);
 }
Esempio n. 2
0
        public static void InvertUndergroundPolicyToggle(NetInfo asset)
        {
            if (!policyInvertUnderground)
            {
                return;
            }
            RoadAI roadAI = asset.m_netAI as RoadAI;

            foreach (NetInfo.Segment segment in roadAI.m_slopeInfo.m_segments)
            {
                if (segment.m_mesh.name.Contains("lines"))
                {
                    segment.m_forwardRequired   ^= NetSegment.Flags.BikeBan;
                    segment.m_forwardForbidden  ^= NetSegment.Flags.BikeBan;
                    segment.m_backwardRequired  ^= NetSegment.Flags.BikeBan;
                    segment.m_backwardForbidden ^= NetSegment.Flags.BikeBan;
                }
            }
            foreach (NetInfo.Segment segment in roadAI.m_tunnelInfo.m_segments)
            {
                if (segment.m_mesh.name.Contains("lines"))
                {
                    segment.m_forwardRequired   ^= NetSegment.Flags.BikeBan;
                    segment.m_forwardForbidden  ^= NetSegment.Flags.BikeBan;
                    segment.m_backwardRequired  ^= NetSegment.Flags.BikeBan;
                    segment.m_backwardForbidden ^= NetSegment.Flags.BikeBan;
                }
            }
        }
Esempio n. 3
0
        public static void NameTest()
        {
            for (uint i = 0; i < PrefabCollection <NetInfo> .LoadedCount(); ++i)
            {
                NetInfo info = PrefabCollection <NetInfo> .GetLoaded(i);

                if (info?.m_netAI is RoadAI)
                {
                    string name = info.GetUncheckedLocalizedTitle();
                    bool   b;
                    //b = name.ToLower().Contains("asym");
                    b = true;
                    if (b)
                    {
                        string m  = name;
                        RoadAI ai = info.m_netAI as RoadAI;
                        //m += "|" + ai?.m_elevatedInfo?.name;
                        //m += "|" + ai?.m_bridgeInfo?.name;
                        //m += "|" + ai?.m_slopeInfo?.name;
                        //m += "|" + ai?.m_tunnelInfo?.name;
                        m += "|| level:" + info.GetClassLevel();
                        m += " class:" + info.m_class;
                        m += " category:" + info.category;
                        Extensions.Log(m);
                    }
                }
            }
            Extensions.Log(Extensions.BIG("DONE PRITING NAMES!"));
        }
Esempio n. 4
0
        public static float GetLengthSnap(RoadAI roadAi)
        {
            if (!SnapController.EnableLengthSnapping)
                return 0f;

            return roadAi.m_enableZoning ? 8f : 0f;
        }
Esempio n. 5
0
        public static NetInfo GetGroundInfo(this NetInfo info)
        {
            if (info.m_netAI is RoadAI)
            {
                return(info);
            }
            int n = PrefabCollection <NetInfo> .LoadedCount();

            for (uint i = 0; i < n; ++i)
            {
                NetInfo info2 = PrefabCollection <NetInfo> .GetLoaded(i);

                if (IsNormalGroundRoad(info2))
                {
                    RoadAI ai = info2.m_netAI as RoadAI;
                    bool   b;
                    b  = ai.m_elevatedInfo == info;
                    b |= ai.m_bridgeInfo == info;
                    b |= ai.m_tunnelInfo == info;
                    b |= ai.m_slopeInfo == info;
                    if (b)
                    {
                        return(info2);
                    }
                }
            }
            return(null);//in case of failure.
        }
Esempio n. 6
0
 internal static void Postfix(RoadAI __instance, ref float __result)
 {
     if (TinyRoadRegistry.IsTinyRoad(__instance.m_info.name))
     {
         __result = Constants.Networks.TinyRoadLengthSnap;
     }
 }
Esempio n. 7
0
        public static float GetLengthSnap(RoadAI roadAi)
        {
            if (!SnapController.EnableLengthSnapping)
            {
                return(0f);
            }

            return(roadAi.m_enableZoning ? 8f : 0f);
        }
Esempio n. 8
0
        public static float GetLengthSnap(RoadAI roadAi)
        {
            if (!SnapController.EnableLengthSnapping)
            {
                return(0f);
            }

            // No net tool overrides this value any more - just return the default.
            return(8f);
        }
Esempio n. 9
0
        public static void ApplyTexture(NetInfo asset)
        {
            ApplyTextureSingleMode(asset);
            RoadAI netAI = asset.m_netAI as RoadAI;

            ApplyTextureSingleMode(netAI.m_elevatedInfo);
            ApplyTextureSingleMode(netAI.m_bridgeInfo);
            ApplyTextureSingleMode(netAI.m_slopeInfo);
            ApplyTextureSingleMode(netAI.m_tunnelInfo);
        }
Esempio n. 10
0
        public static void SetColor(NetInfo asset, Color color)
        {
            SetColorSingleMode(asset, color);
            RoadAI netAI = asset.m_netAI as RoadAI;

            SetColorSingleMode(netAI.m_elevatedInfo, color);
            SetColorSingleMode(netAI.m_bridgeInfo, color);
            SetColorSingleMode(netAI.m_slopeInfo, color);
            SetColorSingleMode(netAI.m_tunnelInfo, color);
        }
Esempio n. 11
0
        internal static bool Prefix(RoadAI __instance, ushort segment, ref NetSegment data)
        {
            if (TinyRoadRegistry.IsTinyRoad(__instance.m_info.name))
            {
                TinyRoadZoneBlocksCreator.CreateZoneBlocks(__instance.m_info, segment, ref data);

                return(false);
            }
            else
            {
                return(true); // execute original
            }
        }
Esempio n. 12
0
        public static void SetOutsideConnection(NetInfo asset)
        {
            RoadAI netAI = asset.m_netAI as RoadAI;

            netAI.m_outsideConnection = PrefabCollection <BuildingInfo> .FindLoaded("Road Connection");

            RoadBaseAI elevatedAI = netAI.m_elevatedInfo.m_netAI as RoadBaseAI;

            elevatedAI.m_outsideConnection = PrefabCollection <BuildingInfo> .FindLoaded("Road Connection");

            RoadBaseAI tunnelAI = netAI.m_tunnelInfo.m_netAI as RoadBaseAI;

            tunnelAI.m_outsideConnection = PrefabCollection <BuildingInfo> .FindLoaded("Road Connection");
        }
Esempio n. 13
0
        public static void EnableElevatedStops()
        {
            NetInfo[] networks = Resources.FindObjectsOfTypeAll <NetInfo>();
            foreach (var network in networks)
            {
                if (!network.m_hasPedestrianLanes)
                {
                    continue;
                }
                RoadAI ai = network.m_netAI as RoadAI;
                if (ai == null)
                {
                    continue;
                }
                bool hasStops = false;
                foreach (NetInfo.Lane lane in network.m_lanes)
                {
                    if (lane.m_stopType != VehicleInfo.VehicleType.None)
                    {
                        hasStops = true;
                        break;
                    }
                }
                if (!hasStops)
                {
                    continue;
                }

                VehicleInfo.VehicleType firstStopType  = network.m_lanes[network.m_sortedLanes[0]].m_stopType;
                VehicleInfo.VehicleType secondStopType = network.m_lanes[network.m_sortedLanes[network.m_sortedLanes.Length - 1]].m_stopType;
                VehicleInfo.VehicleType middleStopType = VehicleInfo.VehicleType.None;

                for (int i = 1; i < network.m_lanes.Length - 2; i++)
                {
                    if (network.m_lanes[network.m_sortedLanes[i]].m_laneType == NetInfo.LaneType.Pedestrian)
                    {
                        middleStopType = network.m_lanes[network.m_sortedLanes[i]].m_stopType;
                        break;
                    }
                }
                EnableStops(ai.m_elevatedInfo, firstStopType, middleStopType, secondStopType);
                EnableStops(ai.m_bridgeInfo, firstStopType, middleStopType, secondStopType);
                EnableStops(ai.m_slopeInfo, firstStopType, middleStopType, secondStopType);
                EnableStops(ai.m_tunnelInfo, firstStopType, middleStopType, secondStopType);
            }
        }
Esempio n. 14
0
        public static void LinkDerivative(NetInfo asset)
        {
            RoadAI netAI = asset.m_netAI as RoadAI;
            // strip the suffix from derivative name
            string sourceName = asset.name.Substring(asset.name.IndexOf('.') + 1);

            sourceName = sourceName.Substring(0, sourceName.LastIndexOf(' ')) + "_Data";
            NetInfo sourceAsset = PrefabCollection <NetInfo> .FindLoaded(sourceName);

            if (sourceAsset != null)
            {
                Debug.Log($"Linking {asset} to {sourceAsset}");
                RoadAI sourceAI = sourceAsset.m_netAI as RoadAI;
                netAI.m_elevatedInfo = sourceAI.m_elevatedInfo;
                netAI.m_bridgeInfo   = sourceAI.m_bridgeInfo;
                netAI.m_slopeInfo    = sourceAI.m_slopeInfo;
                netAI.m_tunnelInfo   = sourceAI.m_tunnelInfo;
            }
        }
Esempio n. 15
0
        public static void CacheNever(IEnumerable <string> roads)
        {
            int count = PrefabCollection <NetInfo> .LoadedCount();

            Never_Table = new Hashtable(count * 10);
            for (uint i = 0; i < count; ++i)
            {
                NetInfo info = PrefabCollection <NetInfo> .GetLoaded(i);

                if (IsNormalGroundRoad(info))
                {
                    string name = GetRoadTitle(info);
                    bool   b    = (bool)roads.Contains(name);
                    RoadAI ai   = info.m_netAI as RoadAI;
                    Never_Table[i] = b;
                    Never_Table[ai.m_slopeInfo.m_prefabDataIndex]    = b;
                    Never_Table[ai.m_elevatedInfo.m_prefabDataIndex] = b;
                    Never_Table[ai.m_bridgeInfo.m_prefabDataIndex]   = b;
                    Never_Table[ai.m_tunnelInfo.m_prefabDataIndex]   = b;
                }
            }
        }
        public void WriteToGame(NetInfo gameNetInfo)
        {
            gameNetInfo.name = this.name;
            Utils.CopyToGame(this.basic, gameNetInfo);
            RoadAI gameRoadAI = (RoadAI)gameNetInfo.m_netAI;

            if (gameRoadAI.m_elevatedInfo != null)
            {
                Utils.CopyToGame(this.elevated, gameRoadAI.m_elevatedInfo);
                gameRoadAI.m_elevatedInfo.name = this.name + "_Elevated0";
            }
            if (gameRoadAI.m_bridgeInfo != null)
            {
                Utils.CopyToGame(this.bridge, gameRoadAI.m_bridgeInfo);
                gameRoadAI.m_bridgeInfo.name = this.name + "_Bridge0";
            }
            if (gameRoadAI.m_slopeInfo != null)
            {
                Utils.CopyToGame(this.slope, gameRoadAI.m_slopeInfo);
                gameRoadAI.m_slopeInfo.name = this.name + "_Slope0";
            }
            if (gameRoadAI.m_tunnelInfo != null)
            {
                Utils.CopyToGame(this.tunnel, gameRoadAI.m_tunnelInfo);
                gameRoadAI.m_tunnelInfo.name = this.name + "_Tunnel0";
            }
            Utils.CopyToGame(this.basicAI, gameRoadAI);
            Utils.CopyToGame(this.elevatedAI, gameRoadAI.m_elevatedInfo?.GetAI());
            Utils.CopyToGame(this.bridgeAI, gameRoadAI.m_bridgeInfo?.GetAI());
            Utils.CopyToGame(this.slopeAI, gameRoadAI.m_slopeInfo?.GetAI());
            Utils.CopyToGame(this.tunnelAI, gameRoadAI.m_tunnelInfo?.GetAI());
            Utils.RefreshRoadEditor();
            Debug.Log(this.basicModel);
            this.basicModel?.Apply(gameNetInfo, "Basic");
            this.elevatedModel?.Apply(gameRoadAI.m_elevatedInfo, "Elevated");
            this.bridgeModel?.Apply(gameRoadAI.m_bridgeInfo, "Bridge");
            this.slopeModel?.Apply(gameRoadAI.m_slopeInfo, "Slope");
            this.tunnelModel?.Apply(gameRoadAI.m_tunnelInfo, "Tunnel");
        }
        public static void AddElevatedStoptypes()
        {
            var networks = UnityEngine.Resources.FindObjectsOfTypeAll <NetInfo>();

            foreach (var network in networks)
            {
                if (!network.m_hasPedestrianLanes)
                {
                    continue;
                }
                RoadAI ai = network.m_netAI as RoadAI;
                if (ai == null)
                {
                    continue;
                }
                bool hasStops = network.m_lanes.Any(lane => lane.m_stopType != VehicleInfo.VehicleType.None);
                if (!hasStops)
                {
                    continue;
                }
                VehicleInfo.VehicleType firstStopType  = network.m_lanes[network.m_sortedLanes[0]].m_stopType;
                VehicleInfo.VehicleType secondStopType = network.m_lanes[network.m_sortedLanes[network.m_sortedLanes.Length - 1]].m_stopType;
                VehicleInfo.VehicleType mediumStopType = VehicleInfo.VehicleType.None;
                for (int i = 1; i < network.m_sortedLanes.Length - 2; i++)
                {
                    if (network.m_lanes[network.m_sortedLanes[i]].m_stopType != VehicleInfo.VehicleType.None)
                    {
                        mediumStopType = network.m_lanes[network.m_sortedLanes[i]].m_stopType;
                        break;
                    }
                }
                EnableStops(ai.m_elevatedInfo, mediumStopType, firstStopType, secondStopType);
                EnableStops(ai.m_bridgeInfo, mediumStopType, firstStopType, secondStopType);
                EnableStops(ai.m_tunnelInfo, mediumStopType, firstStopType, secondStopType);
                EnableStops(ai.m_slopeInfo, mediumStopType, firstStopType, secondStopType);
            }
        }
Esempio n. 18
0
        //private static bool[] Always_array;
        //private static bool[] Never_array;

        public static void CacheAlways(IEnumerable <string> roads)
        {
            int count = PrefabCollection <NetInfo> .LoadedCount();

            //Always_array = new bool[count];
            Always_Table = new Hashtable(count * 10);
            for (uint i = 0; i < count; ++i)
            {
                NetInfo info = PrefabCollection <NetInfo> .GetLoaded(i);

                if (IsNormalGroundRoad(info))
                {
                    string name = GetRoadTitle(info);
                    bool   b    = (bool)roads.Contains(name);
                    RoadAI ai   = info.m_netAI as RoadAI;
                    Always_Table[i] = b;
                    //Extensions.Log($"naem converted to {name} | from {info.name}");
                    Always_Table[ai.m_elevatedInfo.m_prefabDataIndex] = b;
                    Always_Table[ai.m_slopeInfo.m_prefabDataIndex]    = b;
                    Always_Table[ai.m_bridgeInfo.m_prefabDataIndex]   = b;
                    Always_Table[ai.m_tunnelInfo.m_prefabDataIndex]   = b;
                }
            }
        }
Esempio n. 19
0
 public static void GetEffectRadius(RoadAI _this, out float radius, out bool capped, out Color color)
 {
     if (_this.m_enableZoning)
     {
         radius = Mathf.Max(8f, _this.m_info.m_halfWidth) + InputThreadingExtension.userSelectedColumnCount * 8f; // modified
         capped = true;
         if (Singleton<InfoManager>.instance.CurrentMode != InfoManager.InfoMode.None)
         {
             color = Singleton<ToolManager>.instance.m_properties.m_validColorInfo;
             color.a *= 0.5f;
         }
         else
         {
             color = Singleton<ToolManager>.instance.m_properties.m_validColor;
             color.a *= 0.5f;
         }
     }
     else
     {
         radius = 0.0f;
         capped = false;
         color = new Color(0.0f, 0.0f, 0.0f, 0.0f);
     }
 }
Esempio n. 20
0
        public void ReadFromGame(NetInfo gameNetInfo)
        {
            this.name = gameNetInfo.name;
            basic     = new CSNetInfo();
            elevated  = new CSNetInfo();
            bridge    = new CSNetInfo();
            slope     = new CSNetInfo();
            tunnel    = new CSNetInfo();

            basicAI    = new RoadAIProperties();
            elevatedAI = new BridgeAIProperties();
            bridgeAI   = new BridgeAIProperties();
            slopeAI    = new TunnelAIProperties();
            tunnelAI   = new TunnelAIProperties();


            RIUtils.CopyFromGame(gameNetInfo, this.basic);
            RoadAI gameRoadAI = (RoadAI)gameNetInfo.m_netAI;

            RIUtils.CopyFromGame(gameRoadAI.m_elevatedInfo, this.elevated);
            RIUtils.CopyFromGame(gameRoadAI.m_bridgeInfo, this.bridge);
            RIUtils.CopyFromGame(gameRoadAI.m_slopeInfo, this.slope);
            RIUtils.CopyFromGame(gameRoadAI.m_tunnelInfo, this.tunnel);

            RIUtils.CopyFromGame(gameRoadAI, this.basicAI);
            RIUtils.CopyFromGame(gameRoadAI.m_elevatedInfo?.GetAI(), this.elevatedAI);
            RIUtils.CopyFromGame(gameRoadAI.m_bridgeInfo?.GetAI(), this.bridgeAI);
            RIUtils.CopyFromGame(gameRoadAI.m_slopeInfo?.GetAI(), this.slopeAI);
            RIUtils.CopyFromGame(gameRoadAI.m_tunnelInfo?.GetAI(), this.tunnelAI);

            basicModel.Read(gameNetInfo, "Basic");
            elevatedModel.Read(gameRoadAI.m_elevatedInfo, "Elevated");
            bridgeModel.Read(gameRoadAI.m_bridgeInfo, "Bridge");
            slopeModel.Read(gameRoadAI.m_slopeInfo, "Slope");
            tunnelModel.Read(gameRoadAI.m_tunnelInfo, "Tunnel");
        }
Esempio n. 21
0
 [RedirectMethod(false)] // reason for detour: display correct zone area when using NetTool
 public static void GetEffectRadius(RoadAI _this, out float radius, out bool capped, out Color color)
 {
     if (_this.m_enableZoning)
     {
         radius = Mathf.Max(8f, _this.m_info.m_halfWidth) + InputThreadingExtension.userSelectedColumnCount * 8f; // modified
         capped = true;
         if (Singleton <InfoManager> .instance.CurrentMode != InfoManager.InfoMode.None)
         {
             color    = Singleton <ToolManager> .instance.m_properties.m_validColorInfo;
             color.a *= 0.5f;
         }
         else
         {
             color    = Singleton <ToolManager> .instance.m_properties.m_validColor;
             color.a *= 0.5f;
         }
     }
     else
     {
         radius = 0.0f;
         capped = false;
         color  = new Color(0.0f, 0.0f, 0.0f, 0.0f);
     }
 }
        /* 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);
        }
Esempio n. 23
0
 public static float GetLengthSnap(RoadAI roadAi)
 {
     return(8);
 }
Esempio n. 24
0
 public static void ReplaceArrows(NetInfo asset)
 {
     if (!OptionUI.levelLoaded && iroadArrow == 1)
     {
         return;
     }
     if (asset.m_netAI is RoadAI)
     {
         RoadAI roadAI = asset.m_netAI as RoadAI;
         ReplaceArrows(roadAI.m_elevatedInfo);
         ReplaceArrows(roadAI.m_bridgeInfo);
         ReplaceArrows(roadAI.m_tunnelInfo);
         ReplaceArrows(roadAI.m_slopeInfo);
     }
     foreach (NetInfo.Lane lane in asset.m_lanes)
     {
         // arrows are always on a car lane
         if (lane.m_vehicleType == VehicleInfo.VehicleType.Car)
         {
             foreach (NetLaneProps.Prop prop in lane.m_laneProps.m_props)
             {
                 if (prop.m_flagsRequired == NetLane.Flags.Forward && prop.m_flagsForbidden == NetLane.Flags.LeftRight)
                 {
                     if (iroadArrow == 0)
                     {
                         prop.m_prop = PrefabCollection <PropInfo> .FindLoaded("Road Arrow F");
                     }
                     else if (iroadArrow == 2)
                     {
                         prop.m_prop = PrefabCollection <PropInfo> .FindLoaded("[US] Arrow Straight_Data");
                     }
                     prop.m_finalProp = prop.m_prop;
                 }
                 if (prop.m_flagsRequired == NetLane.Flags.ForwardRight && prop.m_flagsForbidden == NetLane.Flags.Left)
                 {
                     if (iroadArrow == 0)
                     {
                         prop.m_prop = PrefabCollection <PropInfo> .FindLoaded("Road Arrow FR");
                     }
                     else if (iroadArrow == 2)
                     {
                         prop.m_prop = PrefabCollection <PropInfo> .FindLoaded("[US] Arrow Straight or Right_Data");
                     }
                     prop.m_finalProp = prop.m_prop;
                 }
                 if (prop.m_flagsRequired == NetLane.Flags.Left && prop.m_flagsForbidden == NetLane.Flags.ForwardRight)
                 {
                     if (iroadArrow == 0)
                     {
                         prop.m_prop = PrefabCollection <PropInfo> .FindLoaded("Road Arrow L");
                     }
                     else if (iroadArrow == 2)
                     {
                         prop.m_prop = PrefabCollection <PropInfo> .FindLoaded("[US] Arrow Left_Data");
                     }
                     prop.m_finalProp = prop.m_prop;
                 }
                 if (prop.m_flagsRequired == NetLane.Flags.LeftForward && prop.m_flagsForbidden == NetLane.Flags.Right)
                 {
                     if (iroadArrow == 0)
                     {
                         prop.m_prop = PrefabCollection <PropInfo> .FindLoaded("Road Arrow LF");
                     }
                     else if (iroadArrow == 2)
                     {
                         prop.m_prop = PrefabCollection <PropInfo> .FindLoaded("[US] Arrow Straight or Left_Data");
                     }
                     prop.m_finalProp = prop.m_prop;
                 }
                 if (prop.m_flagsRequired == NetLane.Flags.Right && prop.m_flagsForbidden == NetLane.Flags.LeftForward)
                 {
                     if (iroadArrow == 0)
                     {
                         prop.m_prop = PrefabCollection <PropInfo> .FindLoaded("Road Arrow R");
                     }
                     else if (iroadArrow == 2)
                     {
                         prop.m_prop = PrefabCollection <PropInfo> .FindLoaded("[US] Arrow Right_Data");
                     }
                     prop.m_finalProp = prop.m_prop;
                 }
             }
         }
     }
 }
Esempio n. 25
0
        static bool NodeModifyMaskPrefix(ushort nodeID, ref NetNode data, ushort segment1, ushort segment2, int index, ref TerrainModify.Surface surface, ref TerrainModify.Heights heights, ref TerrainModify.Edges edges, ref float left, ref float right, ref float leftY, ref float rightY, ref bool __result, ref RoadAI __instance)
        {
            return(true);

            if ((data.m_flags & NetNode.Flags.Bend) == 0)
            {
                //return true; //this is not a bend node, no patch needed
            }
            __result = false;
            return(false);
        }
Esempio n. 26
0
        static bool SegmentModifyMaskPrefix(ushort segmentID, ref NetSegment data, int index, ref TerrainModify.Surface surface, ref TerrainModify.Heights heights, ref TerrainModify.Edges edges, ref float left, ref float right, ref float leftStartY, ref float rightStartY, ref float leftEndY, ref float rightEndY, ref bool __result, ref RoadAI __instance)
        {
            //Debug.Log(segmentID);
            bool   invert      = (data.m_flags & NetSegment.Flags.Invert) != 0;
            ushort startNodeId = data.m_startNode;
            ushort endNodeId   = data.m_endNode;
            float  halfWidth   = __instance.m_info.m_halfWidth;    //TODO: respect bridge etc.

            ProfileSection[] profile    = Profiles.PainterProfile; //TODO: different profiles by mesh type
            NetManager       netManager = Singleton <NetManager> .instance;
            Vector3          startPos   = netManager.m_nodes.m_buffer[startNodeId].m_position;
            Vector3          endPos     = netManager.m_nodes.m_buffer[endNodeId].m_position;
            Vector3          startLeftPos;
            Vector3          startRightPos;
            Vector3          endLeftPos;
            Vector3          endRightPos;

            data.CalculateCorner(segmentID, heightOffset: false, start: true, leftSide: true, out startLeftPos, out Vector3 dir1, out bool smooth1);
            data.CalculateCorner(segmentID, heightOffset: false, start: true, leftSide: false, out startRightPos, out Vector3 dir2, out bool smooth2);
            data.CalculateCorner(segmentID, heightOffset: false, start: false, leftSide: true, out endLeftPos, out Vector3 dir3, out bool smooth3);
            data.CalculateCorner(segmentID, heightOffset: false, start: false, leftSide: false, out endRightPos, out Vector3 dir4, out bool smooth4);
            return(ModifyMask(profile, startPos, endPos, startLeftPos, startRightPos, endLeftPos, endRightPos, halfWidth, invert, index, ref surface, ref heights, ref edges, ref left, ref right, ref leftStartY, ref rightStartY, ref leftEndY, ref rightEndY, ref __result));
        }
Esempio n. 27
0
        public static void LinkBridgeMode(NetInfo asset)
        {
            RoadAI netAI = asset.m_netAI as RoadAI;

            netAI.m_bridgeInfo = netAI.m_elevatedInfo;
        }