Files
GoblinRaid/Assets/Scripts/Control/PatrolPath.cs
Caleb Sandford deQuincey e2b97323a3 Started building first moment
2025-10-31 20:33:41 +00:00

34 lines
795 B
C#

using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
namespace RPG.Control
{
public class PatrolPath : MonoBehaviour
{
float waypointRadius = 0.3f;
void OnDrawGizmos()
{
for (int i = 0; i < transform.childCount; i++)
{
int j = GetNextIndex(i);
Gizmos.DrawSphere(GetWaypoint(i), waypointRadius);
Gizmos.DrawLine(GetWaypoint(i), GetWaypoint(j));
}
}
public int GetNextIndex(int i)
{
if(i + 1 >= transform.childCount)
{
return 0;
}
return i + 1;
}
public Vector3 GetWaypoint(int i)
{
return transform.GetChild(i).position;
}
}
}