public override void Init() { base.Init(); bool startNode = false; for (int i = 0; i < Count; i++) { BaseNode node = Get(i); if (!node) { Debug.LogError("The Node at index '" + i + "' is missing its reference. Removing from NodeDatabase."); base.RemoveAt(i); i--; continue; } if (node is StartNode) { if (!startNode) { startNode = true; } else { Debug.LogError(""); base.Remove(node); (node as StartNode).Delete(true); i--; continue; } } if (!ItemNames.Contains(node.name)) { ItemNames.Add(node.name); } node.Init(); } if (!startNode) { base.Add(NodeObject.CreateNew <StartNode> ("StartNode")); } }
public static void FetchAllNodes() { nodeTypes = new Dictionary <NodeData, BaseNode> (); IEnumerable <Assembly> assems = AppDomain.CurrentDomain.GetAssemblies().Where(a => a.FullName.Contains("Assembly")); foreach (Assembly assem in assems) { foreach (Type type in assem.GetTypes().Where(a => !a.IsAbstract && a.IsClass && a.IsSubclassOf(typeof(BaseNode)))) { NodeAttribute attri = type.GetCustomAttributes(typeof(NodeAttribute), false)[0] as NodeAttribute; if (attri != null && !attri.Hide) { NodeData data = new NodeData(attri); nodeTypes.Add(data, NodeObject.CreateNew <BaseNode> (data.GetClassName)); } } } }