Exemplo n.º 1
0
    private void getKeyInput()
    {
        //Press space to get to the next step
        if (Input.GetKeyUp("space") && targetStep != -1)
        {
            if (targetStep == 0)
            {
                userTimes.Add(Time.time - startTime);
            }
            else
            {
                userTimes.Add(Time.time - getAllTimes() - startTime);
            }
            userSplines.Add(manager.getSpline());
            targetStep += 1;

            if (targetStep == targetCount)
            {
                targetStep = 0;

                targetCanvas.sprite = targetImages[targetStep];
                Debug.Log("finished!");
                compareSpline();
                initLists();
                startTime = Time.time;
                return;
            }
            manager.resetAll();

            Debug.Log("next step!");
            //next image
            targetCanvas.sprite = targetImages[targetStep];
        }

        // reset
        if (Input.GetKeyUp("r"))
        {
            targetStep          = 0;
            targetCanvas.sprite = targetImages[targetStep];

            manager.resetAll();
            StartCoroutine(showInfoText("Object reseted"));
        }
        if (Input.GetKeyUp("f"))
        {
            if (targetStep == -1)
            {
                initLists();
                targetCanvas.sprite = targetImages[0];
                targetCanvas.transform.parent.gameObject.SetActive(true);
                manager.resetAll();
                startTime = Time.time;
                StartCoroutine(showInfoText("Target Mode"));
            }
            else
            {
                targetStep          = -1;
                targetCanvas.sprite = targetImages[0];
                targetCanvas.transform.parent.gameObject.SetActive(false);
                manager.resetAll();
                StartCoroutine(showInfoText("Free Form Mode"));
            }
        }
        if (Input.GetKeyUp("s"))
        {
            String objectName = "stlExport" + Random.Range(0, 100).ToString();
            Export.exportSTL(exportSTLObject.mesh, objectName);
            StartCoroutine(showInfoText("Object exported to Documents/Pottery as " + objectName + ".stl"));
        }
        if (Input.GetKeyUp("e"))
        {
            Export.exportSpline(manager.getSpline().getSpline(), exportId.ToString());
            exportId += 1;
            StartCoroutine(showInfoText("Spline Exported to Documents/Pottery as: " + exportId + ".csv"));
        }
        if (Input.GetKeyUp("1"))
        {
            manager.setPushTool();
            StartCoroutine(showInfoText("Remove Tool selected"));
        }
        if (Input.GetKeyUp("2"))
        {
            manager.setPullTool();
            StartCoroutine(showInfoText("Add Tool selected"));
        }
        if (Input.GetKeyUp("3"))
        {
            manager.setSmoothingTool();
            StartCoroutine(showInfoText("Smoothing Tool selected"));
        }
        if (Input.GetKeyUp("4"))
        {
            manager.setDebugBool();
        }
    }