Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        //mousePos =  (GameObject.Find("HandLeft").transform.position);
        //transform.position = mousePos;

        //Debug.Log(GameObject.Find("HandLeft").transform.position);

        if (GameObject.Find("HandLeft") != null)
        {
            dropLeft = GameObject.Find("HandLeft").GetComponent <DragAndDrop>();
        }
        if (GameObject.Find("HandRight") != null)
        {
            dropRight = GameObject.Find("HandRight").GetComponent <DragAndDrop>();
        }

        //creates initial bin
        if (collisionManager.CheckHandsShowing() && GameObject.Find("bin(Clone)") == null)
        {
            Transform tester = new GameObject().transform;

            Debug.Log(tester.ToString());
            GameObject newBin = Instantiate(bin, tester);
        }


        if (bodySourceView.getLeftCloseFlag() && gameObject.name == "HandLeft")
        {
            dropLeft.DragOrPickUp("HandLeft");
        }
        if (bodySourceView.getRightCloseFlag() && gameObject.name == "HandRight")
        {
            dropRight.DragOrPickUp("HandRight");
        }

        //if hand is open
        if (!bodySourceView.getLeftCloseFlag() && gameObject.name == "HandLeft" && dropLeft.getDrag())
        {
            dropLeft.DropItem();
        }
        //this is to check whether the hand are active


        /*
         * if (HasInput) {
         *              drop.DragOrPickUp ();
         *      } else {
         *              if (drop.getDrag()) {
         *                      drop.DropItem();
         *              }
         *      }
         */
    }
    // Update is called once per frame
    void Update()
    {
        //mousePos =  (GameObject.Find("HandLeft").transform.position);
        //transform.position = mousePos;

        //Debug.Log(GameObject.Find("HandLeft").transform.position);

        if (GameObject.Find("HandLeft") != null)
        {
            dropLeft = GameObject.Find("HandLeft").GetComponent <DragAndDrop>();
        }
        if (GameObject.Find("HandRight") != null)
        {
            dropRight = GameObject.Find("HandRight").GetComponent <DragAndDrop>();
        }

        //creates initial bin + brench
        if (collisionManager.CheckHandsShowing() && GameObject.Find("bin") == null)
        {
            /* Tina: Don't think we need the tester as it just create a random new gameobject
             * Transform tester = new GameObject().transform;
             *
             * Debug.Log(tester.ToString());
             * GameObject newBin = Instantiate(bin, tester);*/

            // destroy the crowd once the hand is activated
            if (GameObject.Find("crowd") != null)
            {
                Destroy(GameObject.Find("crowd"));
            }
            if (GameObject.Find("crowd1") != null)
            {
                Destroy(GameObject.Find("crowd1"));
            }

            GameObject newBin    = Instantiate(bin);
            GameObject newBrench = Instantiate(brench);
            newBin.name    = "bin";
            newBrench.name = "brench";
        }


        if (bodySourceView.getLeftCloseFlag() && gameObject.name == "HandLeft")
        {
            dropLeft.DragOrPickUp("HandLeft");
        }
        if (bodySourceView.getRightCloseFlag() && gameObject.name == "HandRight")
        {
            dropRight.DragOrPickUp("HandRight");
        }

        //if hand is open
        if (!bodySourceView.getLeftCloseFlag() && gameObject.name == "HandLeft" && dropLeft.getDrag())
        {
            dropLeft.DropItem();
        }
        //this is to check whether the hand are active


        /*
         * if (HasInput) {
         *              drop.DragOrPickUp ();
         *      } else {
         *              if (drop.getDrag()) {
         *                      drop.DropItem();
         *              }
         *      }
         */
    }