コード例 #1
0
        public INodeBase Get <T>() where T : INode
        {
            INodeBase output = PrivateGet <T>();

            output.Update();

            return(output);
        }
コード例 #2
0
ファイル: SaveUtility.cs プロジェクト: khill25/Carbon-editor
    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);
    }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
    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();
        }
    }
コード例 #5
0
    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.");
                }
            }
        }
    }
コード例 #6
0
 public static ModelNodeBaseAdapter GetAdapter(IModelNodeAdapterParent parent, INodeBase node)
 {
     return(ModelNodeBaseAdapter.cache.GetObject(new ObjectCacheKey <IModelNodeAdapterParent, INodeBase>(parent, node), parent, node));
 }
コード例 #7
0
 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();
     }
 }
コード例 #8
0
 public void AddChild(INodeBase child)
 {
     children.Add(child);
 }