Esempio n. 1
0
        private static bool TryFindWidthRecord(EcsRoadData roadData, EcsLane lane, float sLocal,
                                               out LaneWidthRecord laneWidthRecord)
        {
            var widthRecordIdx   = 0;
            var foundWidthRecord = false;

            laneWidthRecord = default;

            var laneWidthRecords = lane.GetLaneWidthRecords(roadData.laneWidthRecords);

            for (; widthRecordIdx < laneWidthRecords.Length; widthRecordIdx++)
            {
                var widthRecordNext = laneWidthRecords[widthRecordIdx];
                var sOffsetNext     = widthRecordNext.sSectionOffset;
                if (sOffsetNext > sLocal)
                {
                    break;
                }

                laneWidthRecord  = widthRecordNext;
                foundWidthRecord = true;
            }

            return(foundWidthRecord);
        }
Esempio n. 2
0
        private static bool TryFindWidthRecord(Lane lane, float sLocal,
                                               out LaneWidthRecord laneWidthRecord)
        {
            var widthRecordIdx   = 0;
            var foundWidthRecord = false;

            laneWidthRecord = default;
            if (lane.widthRecords == null)
            {
                Debug.LogWarning("WidthRecords was null, but we'd expect it to be an array of length zero if '" +
                                 "there were no width records.");
                return(false);
            }

            for (; widthRecordIdx < lane.widthRecords.Length; widthRecordIdx++)
            {
                var widthRecordNext = lane.widthRecords[widthRecordIdx];
                var sOffsetNext     = widthRecordNext.sSectionOffset;
                if (sOffsetNext > sLocal)
                {
                    break;
                }

                laneWidthRecord  = widthRecordNext;
                foundWidthRecord = true;
            }

            return(foundWidthRecord);
        }