45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.AI;
|
|
|
|
namespace Code.Example.Race.Racer.AI
|
|
{
|
|
public class AIDebugRacer : Racer
|
|
{
|
|
[SerializeField] private NavMeshAgent navMeshAgent;
|
|
[SerializeField] private List<Transform> waypoints;
|
|
private int _currentWaypointIndex;
|
|
private void Awake()
|
|
{
|
|
navMeshAgent.destination = waypoints[_currentWaypointIndex].position;
|
|
_currentWaypointIndex++;
|
|
}
|
|
|
|
public override void NextWaypoint()
|
|
{
|
|
if(_currentWaypointIndex >= waypoints.Count) _currentWaypointIndex = 0;
|
|
|
|
navMeshAgent.destination = waypoints[_currentWaypointIndex++].position;
|
|
}
|
|
|
|
public override void StartRacer()
|
|
{
|
|
|
|
}
|
|
|
|
public override void StopRacer()
|
|
{
|
|
|
|
}
|
|
|
|
public override void SetData(RacerData data)
|
|
{
|
|
|
|
}
|
|
|
|
public override void Initialize(List<Transform> waypoints)
|
|
{
|
|
|
|
}
|
|
}
|
|
} |