added AI
This commit is contained in:
1 parent
8ea88f9aaf
commit
3c6679ab04
6 files changed
+821
-3
No files matched your search
@@ -1,3 +1,4 @@
|
||||
using Code.Gameplay;
|
||||
using Code.Track;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -8,6 +9,7 @@ namespace Code.UI
|
||||
[SerializeField] private TrackBuilder trackBuilder;
|
||||
[SerializeField] private Transform playerSpawn;
|
||||
[SerializeField] private Transform finishTrigger;
|
||||
[SerializeField] private AICarController[] aiCars;
|
||||
|
||||
private TrackData _currentTrack;
|
||||
|
||||
@@ -23,6 +25,12 @@ namespace Code.UI
|
||||
|
||||
finishTrigger.position = _currentTrack.FinishPosition;
|
||||
finishTrigger.rotation = _currentTrack.FinishRotation;
|
||||
|
||||
foreach (var aiCar in aiCars)
|
||||
{
|
||||
aiCar.transform.position = _currentTrack.Waypoints[0] + Random.insideUnitSphere * 2f;
|
||||
aiCar.GetComponent<AICarController>().SetRoute(_currentTrack.Waypoints.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user