public SharpNoise.Modules.Module InstantiateGenericModule(Data.NodeData nodeData) { //Create instance of selected node type SharpNoise.Modules.Module module = (SharpNoise.Modules.Module)Activator.CreateInstance(Type.GetType(nodeData.moduleType)); module.SetData(nodeData); return(module); }
public virtual void SetData(Data.NodeData data) { name = data.name; id = data.id; windowRect.position = data.windowPosition; showValues = data.showValues; //Set view if (data.isPerspective) { TogglePerspective(); } }
//Used when loading nodes from saved data public void InstantiateGenericNode(Data.NodeData nodeData) { if (nodes == null) { nodes = new List <Node>(); } //Create instance of selected node type Node node = (Node)Activator.CreateInstance(Type.GetType(nodeData.type), Manager.Instance.scene, EventManager.Instance.mousePosition); node.SetData(nodeData); node.BuildConnectionPoints(); nodes.Add(node); }