using System; using System.Collections.Generic; using UnityEngine; namespace UNEB { /// /// Represents a graph of nodes. /// public class NodeGraph : ScriptableObject { /// /// The types of nodes accepted by the graph. /// public static HashSet nodeTypes = new HashSet(); [HideInInspector] public List nodes = new List(); /// /// Add a node to the graph. /// It is recommended that the save manager adds the nodes. /// /// public void Add(Node n) { nodes.Add(n); } /// /// Removes a node from the graph but it is not destroyed. /// /// public void Remove(Node node) { nodes.Remove(node); } /// /// Put the node at the end of the node list. /// /// public void PushToEnd(Node node) { if (nodes.Remove(node)) { nodes.Add(node); } } /// /// Gets called right before the graph is saved. /// Can be used to setup things before saving like sorting nodes. /// public virtual void OnSave() { } } }