diff --git a/.gitignore b/.gitignore index 1f2f5ec..e3e7782 100644 --- a/.gitignore +++ b/.gitignore @@ -86,3 +86,4 @@ Assets/Scripts/Car/Route.cs.meta Assets/Scripts/Buttons/SaveStructs.cs.meta Assets/Scripts/Buttons/LoadButton.cs.meta +Assets/Scripts/Car/Roads.cs.meta diff --git a/.gitignore b/.gitignore index 1f2f5ec..e3e7782 100644 --- a/.gitignore +++ b/.gitignore @@ -86,3 +86,4 @@ Assets/Scripts/Car/Route.cs.meta Assets/Scripts/Buttons/SaveStructs.cs.meta Assets/Scripts/Buttons/LoadButton.cs.meta +Assets/Scripts/Car/Roads.cs.meta diff --git a/Assets/Scripts/Car/Car.cs b/Assets/Scripts/Car/Car.cs index 646eece..dc4f85c 100644 --- a/Assets/Scripts/Car/Car.cs +++ b/Assets/Scripts/Car/Car.cs @@ -86,6 +86,9 @@ } private bool needsBrakingForCar(Car car) { + if (roadIndex == route.roads.Count - 1) { + return false; + } Road conflict = car.road; float otherDistance = conflict.path.length - car.roadPositon; for (int i = car.roadIndex; !this.route.roads.Contains(conflict) && i < car.route.roads.Count;) {