void UpdateTimeSchedule() { float[] mTimeForward = new float[pointList.Length]; mTimeForward[0] = pointList[0].stayTime; for (int i = 1; i < pointList.Length; i++) { float dis = Vector3.Distance(pointList[i].position, pointList[i - 1].position); float needTime = dis / Railway.Manager.TrainSteerSpeed; mTimeForward[i] = mTimeForward[i - 1] + needTime + pointList[i].stayTime; } float[] mTimeBackward = new float[pointList.Length]; mTimeBackward[0] = pointList[pointList.Length - 1].stayTime; int count = 1; for (int i = pointList.Length - 2; i >= 0; i--, count++) { float needTime = Vector3.Distance(pointList[i].position, pointList[i + 1].position) / Railway.Manager.TrainSteerSpeed; mTimeBackward[count] = mTimeBackward[count - 1] + needTime + pointList[i].stayTime; } //Debug.Log("<color=red>forward:" + mTimeBackward[mTimeBackward.Length - 1] + "backward:" + mTimeBackward[mTimeBackward.Length-1]+"</color>"); mRunState.SetSchedule(mTimeForward, mTimeBackward); }