Inheritance: MonoBehaviour
 public Door(string room, string door, string area, OneWay oneWay)
 {
     this.room   = room;
     this.door   = door;
     this.area   = area;
     this.oneWay = oneWay;
 }
Example #2
0
 public void TestOneWay(string s1, string s2, bool expected)
 {
     Assert.Equal(expected, OneWay.oneEditAway(s1, s2));
 }
Example #3
0
        public void NoChanges_Failure(string original, string resulted)
        {
            var oneWay = new OneWay();

            Assert.IsFalse(oneWay.IsOneEdit(original, resulted));
        }
Example #4
0
        public void SeveralEditApplies_Failure(string original, string resulted)
        {
            var oneWay = new OneWay();

            Assert.IsFalse(oneWay.IsOneEdit(original, resulted));
        }
Example #5
0
        public void ReplaceEditApplied_Success(string original, string resulted)
        {
            var oneWay = new OneWay();

            Assert.IsTrue(oneWay.IsOneEdit(original, resulted));
        }
 void ISimpleService.OneWay(OneWay req)
 {
     Debug.Print("OneWay Param=" + req.Param);
 }
        public string GetPrefix(PrefabAI ai, bool isOneWay, bool isSymmetric, float width, byte lanes, Randomizer rand, ushort segmentId, ushort seedId)
        {
            Highway  highway = Highway.ANY;
            RoadType type    = RoadType.NONE;

            if (ai is RoadBaseAI baseAi)
            {
                if (baseAi is DamAI)
                {
                    type = RoadType.DAM;
                }
                else if (baseAi is RoadBridgeAI)
                {
                    type = RoadType.BRIDGE;
                }
                else if (baseAi.IsUnderground())
                {
                    type = RoadType.TUNNEL;
                }
                else
                {
                    type = RoadType.GROUND;
                }
                highway = baseAi.m_highwayRules ? Highway.TRUE : Highway.FALSE;
            }
            if (type == RoadType.NONE)
            {
                LogUtils.DoLog($"AI NAO IDENTIFICADA: {ai}");
                return(null);
            }

            OneWay            wayVal            = isOneWay ? OneWay.TRUE : OneWay.FALSE;
            Symmetry          symVal            = isSymmetric ? Symmetry.TRUE : Symmetry.FALSE;
            LinkingType       linking           = LinkingType.NO_LINKING;
            SeedConfiguration seedConfiguration =
                (AdrNameSeedDataXml.Instance.NameSeedConfigs.TryGetValue(seedId, out AdrNameSeedConfig seedConf) && !(seedConf.HighwayParent is null) ? SeedConfiguration.HAS_HIGHWAY_TYPE : SeedConfiguration.NO_HIGHWAY_TYPE)
                | ((seedConf?.ForcedName).IsNullOrWhiteSpace()? SeedConfiguration.NO_FORCED_NAME : SeedConfiguration.HAS_FORCED_NAME);
            bool hasStart = true;
            bool hasEnd   = true;

            if (wayVal == OneWay.TRUE && lanes <= 2)
            {
                SegmentUtils.GetSegmentRoadEdges(segmentId, true, true, true, out ComparableRoad startRef, out ComparableRoad endRef, out _);
                LogUtils.DoLog($"OneWay s={startRef}; e= {endRef}");
                if (startRef.segmentReference == 0 || endRef.segmentReference == 0)
                {
                    hasStart = startRef.segmentReference != 0;
                    hasEnd   = endRef.segmentReference != 0;
                }
                else if ((NetManager.instance.m_segments.m_buffer[startRef.segmentReference].Info.GetAI() is RoadBaseAI baseAiSource && baseAiSource.m_highwayRules) ||
                         (NetManager.instance.m_segments.m_buffer[endRef.segmentReference].Info.GetAI() is RoadBaseAI baseAiTarget && baseAiTarget.m_highwayRules))

                {
                    switch (startRef.CompareTo(endRef))
                    {
                    case 1:
                        linking = LinkingType.FROM_BIG;
                        break;

                    case 0:
                        linking = LinkingType.SAME_SIZE;
                        break;

                    case -1:
                        linking = LinkingType.FROM_SMALL;
                        break;
                    }
                }
            }

            List <RoadPrefixFileItem> filterResult = m_prefixes.Where(x =>
                                                                      (x.roadType & type) == type &&
                                                                      (x.oneWay & wayVal) == wayVal &&
                                                                      (x.symmetry & symVal) == symVal &&
                                                                      (x.highway & highway) == highway &&
                                                                      (wayVal == OneWay.FALSE || ((x.linking & linking) == linking)) &&
                                                                      (hasStart || !x.requireSource) &&
                                                                      (hasEnd || !x.requireTarget) &&
                                                                      x.minWidth <= width + 0.99f &&
                                                                      width + 0.99f < x.maxWidth &&
                                                                      x.minLanes <= lanes &&
                                                                      lanes < x.maxLanes &&
                                                                      (x.seedConfig & seedConfiguration) == seedConfiguration
                                                                      ).ToList();

            if (filterResult.Count == 0 && linking != LinkingType.NO_LINKING)
            {
                filterResult = m_prefixes.Where(x =>
                                                (x.roadType & type) == type &&
                                                (x.oneWay & wayVal) == wayVal &&
                                                (x.symmetry & symVal) == symVal &&
                                                (x.highway & highway) == highway &&
                                                (wayVal == OneWay.FALSE || ((x.linking & LinkingType.NO_LINKING) == LinkingType.NO_LINKING)) &&
                                                (hasStart || !x.requireSource) &&
                                                (hasEnd || !x.requireTarget) &&
                                                x.minWidth <= width + 0.99f &&
                                                width + 0.99f < x.maxWidth &&
                                                x.minLanes <= lanes &&
                                                lanes < x.maxLanes &&
                                                (x.seedConfig & seedConfiguration) == seedConfiguration
                                                ).ToList();
            }
            LogUtils.DoLog($"Results for: {type} O:{wayVal} S:{symVal} H:{highway} W:{width} L:{lanes} Lk:{linking} Hs:{hasStart} He:{hasEnd} Sc:{seedConfiguration} = {filterResult?.Count}");
            if (filterResult?.Count == 0)
            {
                return(null);
            }

            return(filterResult[rand.Int32((uint)(filterResult.Count))].name);
        }
Example #8
0
 public FlightsPage StepNavigateToOneWay()
 {
     OneWay.Click();
     Thread.Sleep(5000);
     return(this);
 }
 // Use this for initialization
 void Start()
 {
     myController = GetComponent <Controller2D>();
     myOneWay     = GetComponent <OneWay>();
 }