using System.Collections.Generic; using UnityEngine; namespace TowerDefense.Nodes { /// /// Provides a way to select a node for agents to navigate towards /// public abstract class NodeSelector : MonoBehaviour { /// /// A list of Nodes that can be selected by this NodeSelector /// public List linkedNodes; /// /// Gets the next node in the fixed list of nodes /// /// The next node in the list of Nodes, null if the node is the endpoint public abstract Node GetNextNode(); #if UNITY_EDITOR /// /// Draws the links between nodes for editor purposes /// protected virtual void OnDrawGizmos() { if (linkedNodes == null) { return; } int count = linkedNodes.Count; for (int i = 0; i < count; i++) { Node node = linkedNodes[i]; if (node != null) { Gizmos.DrawLine(transform.position, node.transform.position); } } } #endif } }