Exemplo n.º 1
0
    void OnMouseDown()
    {
        // add receiving end of plug/jack
        GameObject newPlug       = null;
        bool       newPlugPlaced = false;

        if (cursorCont.curPlug)
        {
            newPlug = cursorCont.PutDownPlug();
            newPlug.transform.position = transform.position;
            newPlugPlaced = true;

            //Debug.Log("setting this plug's jack controller to " + gameObject.name);
            newPlug.GetComponent <PlugController>().SetNewJackController(gameObject);

            newPlug.transform.parent.GetComponent <WireController>().TestForMatch();

            //if(matchResult == 1)
            //{
            //    CorrectMatchResolve();
            //} else if(matchResult == -1)
            //{
            //    MismatchResolve();
            //}
        }


        if (curPlug)
        {
            cursorCont.PickUpPlug(curPlug);

            curPlug.GetComponent <PlugController>().curJackController = null;

            curPlug = null;
        }

        if (newPlugPlaced)
        {
            curPlug = newPlug;
        }
    }