Exemplo n.º 1
0
    void Update()
    {
        if (input.GetKey(KeyCode.Keypad1))
        {
            if (input.IsPlaying())
            {
                Debug.Log("Recording: 1");
            }
            else
            {
                Debug.Log("1");
            }
        }

        if (input.GetKey(KeyCode.Keypad2))
        {
            if (input.IsPlaying())
            {
                Debug.Log("Recording: 2");
            }
            else
            {
                Debug.Log("2");
            }
        }

        if (input.GetKey(KeyCode.Keypad3))
        {
            if (input.IsPlaying())
            {
                Debug.Log("Recording: 3");
            }
            else
            {
                Debug.Log("3");
            }
        }

        if (Input.GetKeyDown(KeyCode.A))
        {
            input.StartRecording();
        }

        if (Input.GetKeyDown(KeyCode.D))
        {
            Record record = input.StopRecording();

            if (record != null)
            {
                input.Play(record);
            }
        }
    }
Exemplo n.º 2
0
        public void TogglePlay()
        {
            if (lastRecord == null || recorder.IsRecording())
            {
                return;
            }

            if (recorder.IsPlaying())
            {
                recorder.Stop();
                CancelInvoke("PlayingEnds");
            }
            else
            {
                recorder.Play(lastRecord);
                Invoke("PlayingEnds", lastRecord.length + 0.1f);
            }

            UpdateButtons();
        }