Пример гоночки

This commit is contained in:
ThomasCharester committed 2026-01-28 16:30:32 +03:00
1 parent 0f46c63b5d
commit 1f8e14d078
77 files changed
+10246 -90

No files matched your search

@@ -0,0 +1,25 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
namespace Code.Example.Race.Racer.AI
{
public class AIDebugRacer : MonoBehaviour
{
[SerializeField] private NavMeshAgent navMeshAgent;
[SerializeField] private List<Transform> waypoints;
private int _currentWaypointIndex;
private void Awake()
{
navMeshAgent.destination = waypoints[_currentWaypointIndex].position;
_currentWaypointIndex++;
}
public void NextWaypoint()
{
if(_currentWaypointIndex >= waypoints.Count) _currentWaypointIndex = 0;
navMeshAgent.destination = waypoints[_currentWaypointIndex++].position;
}
}
}