public INodeBase Get <T>() where T : INode { INodeBase output = PrivateGet <T>(); output.Update(); return(output); }
public static ArrayList Load(JSON json, string prefabScriptName, System.Type T) { // Load in the file //NodePrefab node = (NodePrefab)json; Object o = Resources.Load(prefabScriptName, T); INodeBase baseNode = o as INodeBase; baseNode.ConvertFromJson(json); return(null); }
public void Activate() { INodeBase parentNodeBase = INodeBase.NodeBases[_parentComponent.ParentNode]; if (_connectorType is ConnectorType.Input) { parentNodeBase.Update(); FlashColourChange(); } if (_connectorType is ConnectorType.Output && parentNodeBase.FlowOutContainer?.Child == _parentComponent) { FlashColourChange(); _pairedConnection?.Activate(); } }
public void SetupAllNodes() { if (allNodes == null) { allNodes = new Dictionary <int, GameObject>(); GameObject[] allNodeObjects = GameObject.FindGameObjectsWithTag("SFNode"); foreach (GameObject obj in allNodeObjects) { NodePrefab p = obj.GetComponent <NodePrefab>(); allNodes.Add(p.nodeId, obj); } } foreach (int nodeId in allNodes.Keys) { INodeBase node = allNodes[nodeId].GetComponent <INodeBase>(); node.SetupConnections(); } }
protected void DoConnectionDragging() { updateCurrentBezierCurve(); if (Input.GetKeyDown(KeyCode.Escape)) { // Disable the line renderer //currentlyDraggingLine tempLineRenderer.gameObject.SetActive(false); GameObject.Destroy(tempLineRenderer.gameObject); tempLineRenderer = null; ChangeState(EditorNodeState.DraggingConnectionEnded); } else if (Input.GetMouseButtonDown(0)) { // Raycast and find the node it clicked on // if it's a valid node then get it // set the destination // and add this into it's list of // connected nodes Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Abs(Camera.main.transform.position.z) + 20)) { INodeBase destination = hit.collider.GetComponent <INodeBase> (); if (destination is EditorNodeBase) { FinishNewConnection(destination as EditorNodeBase); } else { Debug.Log("Clicked node was not an editor node."); } } } }
public static ModelNodeBaseAdapter GetAdapter(IModelNodeAdapterParent parent, INodeBase node) { return(ModelNodeBaseAdapter.cache.GetObject(new ObjectCacheKey <IModelNodeAdapterParent, INodeBase>(parent, node), parent, node)); }
private static ModelNodeBaseAdapter CreateAdapters(ObjectCacheKey <IModelNodeAdapterParent, INodeBase> cacheKey, IModelNodeAdapterParent parent, INodeBase node) { if (node is IModelComplexNode) { return(new ModelComplexNodeAdapter(parent, (IModelComplexNode)node)); } else if (node is IModelValueNode) { return(new ModelValueNodeAdapter(parent, (IModelValueNode)node)); } else if (node is IModelEnumerableNode) { return(new ModelEnumerableNodeAdapter(parent, (IModelEnumerableNode)node)); } else if (node is IPropertyNode) { return(new ModelPropertyNodeAdapter(parent, (IPropertyNode)node)); } else if (node is IEnumerationItemNode) { return(new ModelEnumerationItemNodeAdapter(parent, (IEnumerationItemNode)node)); } else { throw new ArgumentException(); } }
public void AddChild(INodeBase child) { children.Add(child); }