void Update()
    {
        graphScene.Update(1);

        // Mouse Input Action.
        if (Input.GetMouseButton(0))
        {
            Ray        mouseRay = GenerateMouseRay();
            RaycastHit hit;

            if (Physics.Raycast(mouseRay.origin, mouseRay.direction, out hit))
            {
                if (hit.collider.tag == "Node" && SelectedObject == null)
                {
                    SelectedObject = hit.collider.gameObject;
                    ResetLineColor();
                    Selected = false;
                }
            }
            UpdateTypePos();
        }

        if (SelectedObject)
        {
            Vector3 newPos = cam.ScreenToWorldPoint(Input.mousePosition);
            SelectedObject.transform.position = new Vector3(newPos.x, newPos.y, SelectedObject.transform.position.z);

            NeoUnity.Node sn = SelectedObject.GetComponent <NeoUnity.Node>();

            SelectedText.text    = "OBJ: " + sn.gameObject.name;
            SelectedTitle.text   = sn.Title;
            SelectedContent.text = sn.Content;

            if (!Selected)
            {
                ChangeLineColor(SelectedObject);
                Selected = true;
            }
        }

        if (Input.GetMouseButtonUp(0))
        {
            SelectedText.text    = "DRAG A NODE";
            SelectedTitle.text   = "";
            SelectedContent.text = "";
            ResetLineColor();
            Selected       = false;
            SelectedObject = null;
        }

        if (Input.GetMouseButton(1))
        {
            float x = -Input.GetAxis("Mouse X");
            float y = -Input.GetAxis("Mouse Y");
            cam.transform.position += new Vector3(x, y) * (Zoom / MaxZoom) * PanMult;
        }

        Zoom = Mathf.Clamp(Zoom - (Input.GetAxis("Mouse ScrollWheel") * (Zoom / MaxZoom) * ZoomSpeed), MinZoom, MaxZoom);
        cam.orthographicSize = Zoom;
    }
 void Update()
 {
     if (shouldUpdate == true)
     {
         graphScene.Update(2);
     }
 }
示例#3
0
 void Update()
 {
     graphScene.Update(1);
 }