CSL_Traffic.DefaultPathFind.ProcessItem C# (CSharp) Метод

ProcessItem() защищенный Метод

protected ProcessItem ( BufferItem item, ushort targetNode, bool targetDisabled, ushort segmentID, NetSegment &segment, uint lane, byte offset, byte connectOffset ) : void
item BufferItem
targetNode ushort
targetDisabled bool
segmentID ushort
segment NetSegment
lane uint
offset byte
connectOffset byte
Результат void
        protected virtual void ProcessItem(BufferItem item, ushort targetNode, bool targetDisabled, ushort segmentID, ref NetSegment segment, uint lane, byte offset, byte connectOffset)
        {
            if ((segment.m_flags & (NetSegment.Flags.PathFailed | NetSegment.Flags.Flooded)) != NetSegment.Flags.None)
            {
                return;
            }
            NetManager instance = Singleton<NetManager>.instance;
            if (targetDisabled && ((instance.m_nodes.m_buffer[(int)segment.m_startNode].m_flags | instance.m_nodes.m_buffer[(int)segment.m_endNode].m_flags) & NetNode.Flags.Disabled) == NetNode.Flags.None)
            {
                return;
            }
            NetInfo info = segment.Info;
            NetInfo info2 = instance.m_segments.m_buffer[(int)item.m_position.m_segment].Info;
            int num = info.m_lanes.Length;
            uint num2 = segment.m_lanes;
            float num3 = 1f;
            float num4 = 1f;
            NetInfo.LaneType laneType = NetInfo.LaneType.None;
            if ((int)item.m_position.m_lane < info2.m_lanes.Length)
            {
                NetInfo.Lane lane2 = info2.m_lanes[(int)item.m_position.m_lane];
                num3 = lane2.m_speedLimit;
                laneType = lane2.m_laneType;
                if ((byte)(laneType & (NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle)) != 0)
                {
                    laneType = (NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle);
                }
                num4 = this.CalculateLaneSpeed(connectOffset, item.m_position.m_offset, ref instance.m_segments.m_buffer[(int)item.m_position.m_segment], lane2);
            }
            float averageLength = instance.m_segments.m_buffer[(int)item.m_position.m_segment].m_averageLength;
            float num5 = (float)Mathf.Abs((int)(connectOffset - item.m_position.m_offset)) * 0.003921569f * averageLength;
            float num6 = item.m_methodDistance + num5;
            float num7 = item.m_comparisonValue + num5 / (num4 * this.m_maxLength);
            Vector3 b = instance.m_lanes.m_buffer[(int)((UIntPtr)item.m_laneID)].CalculatePosition((float)connectOffset * 0.003921569f);
            int num8 = 0;
            while (num8 < num && num2 != 0u)
            {
                if (lane == num2)
                {
                    NetInfo.Lane lane3 = info.m_lanes[num8];
                    if (lane3.CheckType(this.m_laneTypes, this.m_vehicleTypes))
                    {
                        Vector3 a = instance.m_lanes.m_buffer[(int)((UIntPtr)lane)].CalculatePosition((float)offset * 0.003921569f);
                        float num9 = Vector3.Distance(a, b);
                        BufferItem item2;
                        item2.m_position.m_segment = segmentID;
                        item2.m_position.m_lane = (byte)num8;
                        item2.m_position.m_offset = offset;
                        if ((byte)(lane3.m_laneType & laneType) == 0)
                        {
                            item2.m_methodDistance = 0f;
                        }
                        else
                        {
                            item2.m_methodDistance = num6 + num9;
                        }
                        if (lane3.m_laneType != NetInfo.LaneType.Pedestrian || item2.m_methodDistance < 1000f)
                        {
                            item2.m_comparisonValue = num7 + num9 / ((num3 + lane3.m_speedLimit) * 0.5f * this.m_maxLength);
                            if ((segment.m_flags & NetSegment.Flags.Invert) != NetSegment.Flags.None)
                            {
                                item2.m_direction = NetInfo.InvertDirection(lane3.m_finalDirection);
                            }
                            else
                            {
                                item2.m_direction = lane3.m_finalDirection;
                            }
                            if (lane == this.m_startLaneA)
                            {
                                if (((byte)(item2.m_direction & NetInfo.Direction.Forward) == 0 || item2.m_position.m_offset < this.m_startOffsetA) && ((byte)(item2.m_direction & NetInfo.Direction.Backward) == 0 || item2.m_position.m_offset > this.m_startOffsetA))
                                {
                                    return;
                                }
                                float num10 = this.CalculateLaneSpeed(this.m_startOffsetA, item2.m_position.m_offset, ref segment, lane3);
                                float num11 = (float)Mathf.Abs((int)(item2.m_position.m_offset - this.m_startOffsetA)) * 0.003921569f;
                                item2.m_comparisonValue += num11 * segment.m_averageLength / (num10 * this.m_maxLength);
                            }
                            if (lane == this.m_startLaneB)
                            {
                                if (((byte)(item2.m_direction & NetInfo.Direction.Forward) == 0 || item2.m_position.m_offset < this.m_startOffsetB) && ((byte)(item2.m_direction & NetInfo.Direction.Backward) == 0 || item2.m_position.m_offset > this.m_startOffsetB))
                                {
                                    return;
                                }
                                float num12 = this.CalculateLaneSpeed(this.m_startOffsetB, item2.m_position.m_offset, ref segment, lane3);
                                float num13 = (float)Mathf.Abs((int)(item2.m_position.m_offset - this.m_startOffsetB)) * 0.003921569f;
                                item2.m_comparisonValue += num13 * segment.m_averageLength / (num12 * this.m_maxLength);
                            }
                            item2.m_laneID = lane;
                            item2.m_lanesUsed = (item.m_lanesUsed | lane3.m_laneType);
                            this.AddBufferItem(item2, item.m_position);
                        }
                    }
                    return;
                }
                num2 = instance.m_lanes.m_buffer[(int)((UIntPtr)num2)].m_nextLane;
                num8++;
            }
        }

Same methods

DefaultPathFind::ProcessItem ( BufferItem item, ushort targetNode, ushort segmentID, NetSegment &segment, int &currentTargetIndex, byte connectOffset, bool enableVehicle, bool enablePedestrian ) : bool
DefaultPathFind::ProcessItem ( BufferItem item, ushort nodeID, NetNode &node, byte connectOffset, bool isMiddle ) : void
DefaultPathFind::ProcessItem ( BufferItem item, ushort targetNode, ushort segmentID, NetSegment &segment, byte connectOffset, int laneIndex, uint lane ) : void