Exemplo n.º 1
0
    public void OnMouseUp()
    {
        if (GetNode().draggable.followUI)
        {
            return;            //do nothing if it hasnt been purchased yet
        }
        if (UIConnectorIn.currentHoveredConnector)
        {
            if (UIConnectorIn.currentHoveredConnector.GetNode().draggable.followUI)
            {
                //purchase this node
                if (!GameManager.instance.recipeManager.PurchaseNode(UIConnectorIn.currentHoveredConnector.GetNode()))
                {
                    //if we cant afford it player cant take it
                    return;
                }
                UIConnectorIn.currentHoveredConnector.GetNode().draggable.followUI = false;
            }
            endPoint            = UIConnectorIn.currentHoveredConnector;
            endPoint.startPoint = this;
        }
        else
        {
            line.enabled = false;
            line.SetPosition(0, transform.position);
            line.SetPosition(1, transform.position);
            line.SetPosition(2, transform.position);
            line.SetPosition(3, transform.position);
        }

        Debug.Log("drag end");
        currentDraggedConnector = null;
    }
Exemplo n.º 2
0
 private void OnMouseUp()
 {
     if (tempOut)
     {
         tempOut.OnMouseUp();
         tempOut = null;
     }
 }
Exemplo n.º 3
0
 private void OnMouseDown()
 {
     if (startPoint)
     {
         tempOut = startPoint;
         startPoint.OnMouseDown();
     }
 }
Exemplo n.º 4
0
    public void OnMouseDown()
    {
        if (GetNode().draggable.followUI)
        {
            return;            //do nothing if it hasnt been purchased yet
        }
        if (endPoint)
        {
            endPoint.startPoint = null;
        }
        endPoint = null;

        Vector3 linePoint = transform.position;

        linePoint.z = -1;
        line.SetPosition(0, linePoint);
        linePoint.x = linePoint.x + lineBendDistance;
        line.SetPosition(1, linePoint);

        currentDraggedConnector = this;

        StartCoroutine(LineAfterOneFrame());
        Debug.Log("drag start");
    }