You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
using System.Collections ;
using System.Collections.Generic ;
using UnityEngine ;
public static class Const
{
//行车安全距离
public static float SafeDistance = 12f ;
//安全检测开始时间
public static float SafeCheckTime = 2f ;
//车辆转弯速度
public static float CarTurnSpeed = 5f ;
//刷车最小/最大时间
public static float RefreshCarminTime = 0.7f ;
public static float RefreshCarmaxTime = 1.2f ;
public static int RoadCheckNumber = 6 ;
public static float CarMultiple = 1.2f ;
public static float AccTime = 60f ;
/// <summary>
/// 索引法随机
/// </summary>
/// <param name="minValue"></param>
/// <param name="maxValue"></param>
/// <returns></returns>
public static int [ ] GetIndexRandomNum ( int minValue , int maxValue )
{
System . Random random = new System . Random ( ) ;
int sum = Mathf . Abs ( maxValue - minValue ) ; //计算数组范围
int site = sum ; //设置索引范围
int [ ] index = new int [ sum ] ;
int [ ] result = new int [ sum ] ;
int temp = 0 ;
for ( int i = minValue ; i < maxValue ; i + + )
{
index [ temp ] = i ;
temp + + ;
}
for ( int i = 0 ; i < sum ; i + + )
{
int id = random . Next ( 0 , site - 1 ) ;
result [ i ] = index [ id ] ;
index [ id ] = index [ site - 1 ] ; //因id随机到的数已经获取到了, 用最后的一个数来替换它
site - - ; //缩小索引范围
}
return result ;
}
}