Пример #1
0
        private void CompleteRecording()
        {
            clipRecording.StopRecording();
            recorded = true;

            round.playerRecording = clipRecording;
            repeatPhraseText.gameObject.SetActive(false);

            playTimer = recordTime;
            PlayBackwards();
        }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (clipRecording.IsRecording())
        {
            timer += Time.deltaTime;

            waveform.DrawWaveform();

            if (timer >= recordTime)
            {
                clipRecording.StopRecording();
            }
        }
        else if (clipRecording.IsPlaying())
        {
            if (clipRecording.GetPlayDir() > 0)
            {
                if (timer < recordTime)
                {
                    timer += Time.deltaTime;
                }

                if (timer >= recordTime)
                {
                    clipRecording.StopClip(audioSrc);
                }
            }
            else if (clipRecording.GetPlayDir() < 0)
            {
                if (timer > 0)
                {
                    timer -= Time.deltaTime;
                }

                if (timer <= 0)
                {
                    clipRecording.StopClip(audioSrc);
                }
            }
        }
        waveform.SetPlayhead(timer / recordTime);
    }