Пример гоночки
This commit is contained in:
1 parent
0f46c63b5d
commit
1f8e14d078
77 files changed
+10246
-90
No files matched your search
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 391fdca5d5c94a86bcbd0f7cda609ee7
|
||||
timeCreated: 1769522152
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6644b39029d14164961d83a37749e6cc
|
||||
timeCreated: 1769522190
|
||||
Reference in new issue
Block a user