using System.Collections; using System.Collections.Generic; using UnityEngine; using System; /// Base class for all node graphs public class NodeGraph { /// All nodes in the graph. /// See: public List nodes = new List(); public T AddNode() where T : Node { T node = default(T); nodes.Add(node); return node; } public Node AddNode(Type type) { Node node = (Node)Activator.CreateInstance(type); if (node == null) { Debug.LogError("Node could node be instanced"); return null; } nodes.Add(node); return node; } /// Safely remove a node and all its connections /// public void RemoveNode(Node node) { node.ClearConnections(); nodes.Remove(node); } public void Clear() { nodes.Clear(); } }