示例#1
0
    void OnMouseOver()
    {
        if (Input.GetMouseButtonDown(0))
        {
            isDragging = true;
            Disconnect();

            conMan.CarrySignal(node.gameObject);
            Destroy(this.gameObject);
        }
    }
示例#2
0
    //When the sprite has been moused over
    public virtual void OnMouseOver()
    {
        //When the player clicks
        if (Input.GetMouseButtonDown(0))
        {
            //if this node is powered and the connection manager is carrying a signal
            if (!connectionManager.isCarryingSignal)
            {
                //  Manage picking up the signal
                if (outputs.Count < maximumOutputs)
                {
                    print("MaxOut: " + maximumOutputs);
                    connectionManager.CarrySignal(this.gameObject);
                }
            }
        }

        //Used for placing the signal exclusively
        if (Input.GetMouseButtonUp(0))
        {
            foreach (GameObject startingN in startingNodes)
            {
                startingN.GetComponent <SignalFlowStart>().CheckNodes();
            }
            Debug.Log("Done a thing");
            if (connectionManager.isCarryingSignal && connectionManager.inputFrom != this.gameObject)
            {
                Debug.Log("Done another thing");
                if (!isPowered)
                {
                    //If check returns true, then run place signal on the connection amanger
                    Debug.Log("Still doing things");
                    if (Check())
                    {
                        Debug.Log("Connection Made.");
                        AudioManager.Instance.PlayClip(connectionSound, AudioManager.Instance.GetChannel("SFX"));

                        connectionManager.inputFrom.GetComponent <aNode>().PlaceSignal(this.gameObject);
                        Debug.Log("More things being done");
                    }
                }
                else if (isPowered)
                {
                    //If check returns true and I can still accept inputs
                    if (Check() && inputs.Count < maximumInputs)
                    {
                        connectionManager.inputFrom.GetComponent <aNode>().PlaceSignal(this.gameObject);
                        Debug.Log("Still more things being done");
                    }
                }
            }
        }
    }