Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        // If we press the left mouse button, save mouse location
        if (Input.GetMouseButtonDown(0))
        {
            mousePosition1 = Input.mousePosition;
            // If we are in style mode
            if (inputMode == Mode.Style)
            {
                /*Ray ray = Camera.main.ScreenPointToRay(mousePosition1);
                 * Plane xy = new Plane(Vector3.forward, new Vector3(0, 0, 0));
                 * float distance;
                 * xy.Raycast(ray, out distance);*/
                Vector3 v3 = Input.mousePosition;
                v3.z = 20.0f;
                v3   = Camera.main.ScreenToWorldPoint(v3);


                /*LayerMask groundMask = new LayerMask();
                 * Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                 * RaycastHit hit;
                 * Physics.Raycast(ray.origin, out hit, Mathf.Infinity, groundMask);*/

                // TODO remove this: Instantiate a Chair at the target location
                inputStyle.MouseClick(v3);
                Debug.Log("Spawned Chair");
            }


            isSelecting = true;
        }
        // If we let go of the left mouse button, end selection
        if (Input.GetMouseButtonUp(0))
        {
            isSelecting = false;
        }


        // If we are scrolling with the moues wheel, change the camera's orthographic position
        if (Input.GetAxis("Mouse ScrollWheel") != 0f)
        {
            ZoomCamera(new Vector3(0, 0, 0));
        }
    }