CSL_Traffic.LaneManager.GetLaneSpeed C# (CSharp) Метод

GetLaneSpeed() публичный статический Метод

public static GetLaneSpeed ( uint laneId, NetInfo lane ) : float
laneId uint
lane NetInfo
Результат float
        public static float GetLaneSpeed(uint laneId, NetInfo.Lane lane)
        {
            if ((TrafficMod.Options & OptionsManager.ModOptions.RoadCustomizerTool) != OptionsManager.ModOptions.RoadCustomizerTool)
            {
                return lane.m_speedLimit;
            }

            return GetLane(laneId).m_speed;
        }

Usage Example

Пример #1
0
        protected override void CalculateSegmentPosition(ushort vehicleID, ref Vehicle vehicleData, PathUnit.Position position, uint laneID, byte offset, out Vector3 pos, out Vector3 dir, out float maxSpeed)
        {
            NetManager instance = Singleton <NetManager> .instance;

            instance.m_lanes.m_buffer[(int)((UIntPtr)laneID)].CalculatePositionAndDirection((float)offset * 0.003921569f, out pos, out dir);
            NetInfo info = instance.m_segments.m_buffer[(int)position.m_segment].Info;

            if (info.m_lanes != null && info.m_lanes.Length > (int)position.m_lane)
            {
                maxSpeed = this.CalculateTargetSpeed(vehicleID, ref vehicleData, LaneManager.GetLaneSpeed(laneID, info.m_lanes[(int)position.m_lane]), instance.m_lanes.m_buffer[(int)((UIntPtr)laneID)].m_curve);
            }
            else
            {
                maxSpeed = this.CalculateTargetSpeed(vehicleID, ref vehicleData, 1f, 0f);
            }
        }
All Usage Examples Of CSL_Traffic.LaneManager::GetLaneSpeed