コード例 #1
0
    private void Update()
    {
        if (firstRun)
        {
            for (int i = 0; i < startingFrames - 1; i++)
            {
                latk.inputNewFrame();
            }
            latk.inputPlay();
            firstRun = false;
        }

        try {
            if (doSmoothing)
            {
                latk.target.position = Vector3.Lerp(latk.target.position, hands.lastPos, smoothing);
            }
            else
            {
                latk.target.position = hands.lastPos;
            }
        } catch (UnityException e) { }

        latk.clicked = hands.handPressed;
    }
コード例 #2
0
 private void Update()
 {
     if (firstRun)
     {
         for (int i = 0; i < startingFrames - 1; i++)
         {
             latk.inputNewFrame();
         }
         latk.inputPlay();
         firstRun = false;
     }
 }
コード例 #3
0
ファイル: GMLDraw.cs プロジェクト: n1ckfg/latkxExtras
    private void Start()
    {
        url = Application.dataPath + "/StreamingAssets/" + fileName;

        if (gmlMode == GMLMode.READ_DRAW)
        {
            for (int i = 0; i < drawFrames; i++)
            {
                latk.inputNewFrame();
            }
            if (playWhileDrawing)
            {
                latk.inputPlay();
            }
        }

        StartCoroutine(LoadGML(url));
    }
コード例 #4
0
    void OnGUI()
    {
        if (showButtons)
        {
            string isOn = "";

            if (menuCounter == 1)
            {
                // 1-1.
                Rect writeButton = new Rect(BUTTON_GAP_X, Screen.height - (1 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
                //isOn = latk.showOnionSkin ? "Off" : "On";
                if (GUI.Button(writeButton, FONT_SIZE + "Write" + "</size>"))
                {
                    latk.armWriteFile = true;
                }

                // 1-2.
                Rect undoButton = new Rect(BUTTON_GAP_X, Screen.height - (2 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
                //isOn = latk.showOnionSkin ? "Off" : "On";
                if (GUI.Button(undoButton, FONT_SIZE + "Undo" + "</size>"))
                {
                    latk.inputEraseLastStroke();
                }

                // 1-3.
                Rect onionButton = new Rect(BUTTON_GAP_X, Screen.height - (3 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
                isOn = latk.showOnionSkin ? "Off" : "On";
                if (GUI.Button(onionButton, FONT_SIZE + "Onion Skin " + isOn + "</size>"))
                {
                    latk.inputOnionSkin();
                }

                // 1-4.
                Rect copyFrameButton = new Rect(BUTTON_GAP_X, Screen.height - (4 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
                //isOn = m_arCameraPostProcess.enabled ? "Off" : "On";
                if (GUI.Button(copyFrameButton, FONT_SIZE + "Copy Frame" + "</size>"))
                {
                    latk.inputNewFrameAndCopy();
                }

                // 1-5.
                Rect newFrameButton = new Rect(BUTTON_GAP_X, Screen.height - (5 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
                //isOn = m_arCameraPostProcess.enabled ? "Off" : "On";
                if (GUI.Button(newFrameButton, FONT_SIZE + "New Frame" + "</size>"))
                {
                    latk.inputNewFrame();
                }

                // 1-6.
                Rect playButton = new Rect(BUTTON_GAP_X, Screen.height - (6 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
                isOn = latk.isPlaying ? "Stop" : "Play";
                if (GUI.Button(playButton, FONT_SIZE + isOn + "</size>"))
                {
                    //if (!latk.isPlaying && !playButtonBlock) {
                    latk.inputPlay();
                    //playButtonBlock = true;
                    //} else {
                    //latk.inputFrameBack(); // this is simpler than solving with script execution order
                    //playButtonBlock = false;
                    //}
                }

                // 1-7.
                Rect rewButton = new Rect(BUTTON_GAP_X, Screen.height - (7 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X / 2f, BUTTON_SIZE_Y);
                //isOn = m_arCameraPostProcess.enabled ? "Off" : "On";
                if (GUI.Button(rewButton, FONT_SIZE + "<|" + "</size>"))
                {
                    latk.inputFrameBack();
                }

                Rect ffButton = new Rect(BUTTON_GAP_X + (BUTTON_SIZE_X / 2f), Screen.height - (7 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X / 2f, BUTTON_SIZE_Y);
                //isOn = m_arCameraPostProcess.enabled ? "Off" : "On";
                if (GUI.Button(ffButton, FONT_SIZE + "|>" + "</size>"))
                {
                    latk.inputFrameForward();
                }
            }
            else if (menuCounter == 2)
            {
                // 2-7.
                Rect readButton = new Rect(BUTTON_GAP_X, Screen.height - (7 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
                //isOn = latk.showOnionSkin ? "Off" : "On";
                if (GUI.Button(readButton, FONT_SIZE + "Read" + "</size>"))
                {
                    latk.armReadFile = true;
                }
            }

            // 8.
            Rect menuButton = new Rect(BUTTON_GAP_X, Screen.height - (8 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
            //isOn = m_arCameraPostProcess.enabled ? "Off" : "On";
            if (GUI.Button(menuButton, FONT_SIZE + "MENU " + menuCounter + "</size>"))
            {
                menuCounter++;
                if (menuCounter > menuCounterMax)
                {
                    menuCounter = 1;
                }
            }
        }
    }