示例#1
0
        private void Update()
        {
            if (!m_isPlaying)
            {
                return;
            }

            m_timer += Time.deltaTime;

            if (!m_audioSource.isPlaying && (m_timer >= 0.0f))
            {
                if (OnSongStartedPlaying != null)
                {
                    OnSongStartedPlaying();
                }

                m_audioSource.Play();
            }

            if (m_timer >= m_audioSource.clip.length)
            {
                m_isPlaying = false;

                if (OnSongFinishedPlaying != null)
                {
                    OnSongFinishedPlaying();
                }

                m_audioSource.Stop();
                m_audioSource.clip = null;

                return;
            }

            while (m_noteIndex < m_notes.Count)
            {
                if ((m_notes[m_noteIndex].timeInSong - timeOffset) <= m_timer)
                {
                    if (m_guitarHeroGameController.forceScalingMode)
                    {
                        m_noteSpawner.SpawnForceScalingNote(m_notes[m_noteIndex], m_timer);
                    }
                    else
                    {
                        m_noteSpawner.SpawnNote(m_notes[m_noteIndex], m_timer);
                    }
                    m_noteIndex++;
                }
                else
                {
                    break;
                }
            }
        }